Re: EnableThemingInScope not being removed

From: Willy Denoyette [MVP] (willy.denoyette_at_pandora.be)
Date: 01/13/05


Date: Thu, 13 Jan 2005 09:40:36 +0100

Stack overflow has nothing to do with GC, objects are NOT stack allocated.
SafeNativeMethods.EnableThemingInScope is not a class it's a method, so how
can you even see instances of it?
Your problem is mostly due to uncontrolled (or infinite) recursion.

Willy.

"EChang" <EChang@discussions.microsoft.com> wrote in message
news:87C8287E-B25F-441A-8502-8D6B1482E120@microsoft.com...
> Thx for the response.
>
> Just by keeping Task Manager open I can see the total memory usage of the
> app increasing until I get stack overflow errors.
>
> My problem is that I do not even know where these instances are being
> allocated. If I knew that, then I might know how to remove the references
> keeping it allocated.
>
> I found something helpful online however, though I do not fully understand
> it.
>
> "If you look at the samples that ship with the managed dx sdk, you will
> notice that they use Application. DoEvents to drive the app. In the effect
> editor, I was seeing objects of type EnableThemingInScope that were
> created
> in something called by Application.DoEvents that weren't behaving as short
> lived objects, they were surviving GCs. I spoke with the Windows.Forms
> guys,
> asked them about this behavior and they told me that this was a
> heavyweight
> API and that I shouldn't be using it for this purpose. They suggested
> hooking
> up to the OnIdle event and checking the message queue with an unmanaged
> API
> until they provide something like IsIdle()."
>
> From:
> http://www.xplsv.com/blogs/devdiary/2003_06_01_archive.html
>
> I don't understand what a heavyweight API is. Also, Application.DoEvents
> is
> called so that while something in my code is processing, other events can
> be
> handled. I still want that functionality in my app. How can I keep
> Application.DoEvents but not have the problems with instances of
> EnableThemingInScope eventually killing my app?
>
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
>> EChang,
>>
>> How are you seeing runaway? They are not collected by the GC if
>> references are held to them. If they are around, it is because something
>> is
>> holding them.
>>
>> What is holding them?
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mvp@spam.guard.caspershouse.com
>>
>> "EChang" <EChang@discussions.microsoft.com> wrote in message
>> news:AA7AC584-8AF3-41B0-A720-1D2D5B1A687F@microsoft.com...
>> > I'm having trouble with memory runaway and after using .NET Memory
>> > Profiler,
>> > I'm finding the class SafeNativeMethods.EnableThemingInScope has
>> > instances
>> > allocated frequently while not being removed.
>> >
>> > This is in UI app with multiple forms available to be selected via a
>> > toolbar.
>> >
>> > How can I ensure that these instances are collected by the GC?
>>
>>
>>



Relevant Pages

  • Re: catching Runtime Stack Overflow Exception
    ... appdomain should isolate the hosting application from the catastrophic ... the app ... domain should be allowed to crash and the hosting application should simply ... >> during stack overflow, finally blocks won't fire because there is no ...
    (microsoft.public.dotnet.framework)
  • Re: Application "Nuked"
    ... Should be easy to create a test to verify it. ... Read that somewhere too, now just created a very simple test app for this, ... in a main thread you get stack overflow exception handled by the default app ... exception handler. ...
    (borland.public.delphi.non-technical)
  • Re: Application "Nuked"
    ... < test app for this, and in a main thread you get stack overflow ... > exception handled by the default app exception handler. ...
    (borland.public.delphi.non-technical)
  • Re: Application "Nuked"
    ... > Put the stack overflow in a button and press it twice. ... The app should ... > vanish on the second try. ...
    (borland.public.delphi.non-technical)
  • Re: [openib-general] Re: [PATCH][RFC][0/4] InfiniBand userspace verbs implementation
    ... > The problem is that our driver and library implement an API that we don't ... > tells the library to register it. ... The app then goes on its merry way until ... at which point it tells the library to deregister the memory. ...
    (Linux-Kernel)