Re: EnableThemingInScope not being removed
From: Willy Denoyette [MVP] (willy.denoyette_at_pandora.be)
Date: 01/13/05
- Next message: Nick Malik [Microsoft]: "Re: Preferences Dialog in C#"
- Previous message: pcserver: "Re: How to integrate the .NET Framework with the program?Thanks"
- In reply to: EChang: "Re: EnableThemingInScope not being removed"
- Messages sorted by: [ date ] [ thread ]
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?
>>
>>
>>
- Next message: Nick Malik [Microsoft]: "Re: Preferences Dialog in C#"
- Previous message: pcserver: "Re: How to integrate the .NET Framework with the program?Thanks"
- In reply to: EChang: "Re: EnableThemingInScope not being removed"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|