System.OutOfMemory exception: error creating window handle

From: Serge Lobko-Lobanovsky (arilou_camper_at_discussions.microsoft.com)
Date: 10/14/04


Date: Thu, 14 Oct 2004 06:31:07 -0700

Hi,

Software:
.NET 1.1 (both non-SP and SP1)
Visual Studio .NET 2003
MS SQL Server 2000 SP3
Windows XP SP 2

Hardware:
Intel Celeron 1700, Pentium 4 2.4GHz, AMD Athlon 1100
RAM 256-512 DDR

I've run into a strange problem. There is an application which allows to:
1) connect to a certain device using a modem
2) manage different aspects (mostly, working with MS SQL Server)
Serial communication is done on a separate thread, one per each connection.
The maximum number of simultaneous connections is 20.

Note: what is written below applies only when running the application not
under the debugger.

The app starts and works correctly: accepts incoming calls, performs
different scenarios, dials out when necessary. When the comms thread needs to
modify the UI, it is correctly done using Control.BeginInvoke. However,
sometimes (on different computers) the following exception is thrown:

System.OutOfMemory exception: error creating window handle --->
System.NullReferenceException: Object reference not set to an instance of
object.
at System.Windows.Forms.ThreadContext.OnThreadException
at System.Windows.Forms.Control.WndProcException
at System.Windows.Forms.ControlNativeWindow.OnThreadException
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(int32, string,
string, int32, int32, int32, int32, int32, HandleRef, HandleRef, HandleRef,
object)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(int32, string,
string, int32, int32, int32, int32, int32, HandleRef, HandleRef, HandleRef,
object)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams)
-- End of inner exception stack trace --
at System.Windows.Forms.ThreadContext.OnThreadException
at System.Windows.Forms.Control.WndProcException
at System.Windows.Forms.ControlNativeWindow.OnThreadException
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef, int32)
at System.Windows.Forms.Control.SetVisibleCore
at System.Windows.Forms.Form.SetVisibleCore
at System.Windows.Forms.Control.set_Visible
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog
at <my form-my code to ShowDialog>

What could be the problem?
Let me stress that this does not happen under debuggers. When debugging, the
exception is not thrown. It was noted that this happens more often when
having an active connection.

-- 
Regards,
Serge (Logic Software)


Relevant Pages

  • System.OutOfMemory exception: error creating window handle
    ... I've run into a strange problem. ... working with MS SQL Server) ... under the debugger. ... sometimes the following exception is thrown: ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: SqlWB BSOD on Table Data Edit 1000008e
    ... Did you check for updated video drivers? ... Did you apply SP 2 for SQL Server on your PC? ... Usually the exception address pinpoints ... If this happens, make sure a debugger gets connected, and the ...
    (microsoft.public.sqlserver.tools)
  • Re: Exception occurs only when run outside the debugger *confused*
    ... > I have a very strange problem here: ... > My program throws an exception coming from the glibmm library when I ... However, when I run it with the debugger, it ... Debuggers can use different memory management than the ...
    (comp.programming)
  • Exception occurs only when run outside the debugger *confused*
    ... I have a very strange problem here: ... My program throws an exception coming from the glibmm library when I start it normally. ... However, when I run it with the debugger, it runs just fine! ... I can post my makefile if that helps. ...
    (comp.programming)
  • Re: ASP.NET 2.0 - a newbie question
    ... the exception can be identified using the exception stack trace below. ... established connection failed because connected host has failed to ... connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& ... Microsoft SQL Server? ...
    (microsoft.public.dotnet.framework.aspnet)