|
|
|
start date: Thu, 16 Aug 2007 03:39:37 -0700,
posted on: microsoft.public.dotnet.framework.compactframework
back
| Thread Index |
|
1
Daan
|
|
2
ctacke/ ctacke[at]opennetcf[dot]com
|
|
3
Peter Morris
|
|
4
Daan
|
Memory leaks and how to solve them
Users of the application I have developed report an occasional
OutOfMemoryException. This prompted me to do some research on memory
management and related issues and I have learned to use the NetCFRPM
tool in combination with perfmon.
In my application, there is a task list. When the user clicks on a
task, the details of this task are shown. Tapping 'back' takes them
back to the task list. I can see with the tools that every time the
user views details and goes back, the Managed Bytes Allocated counter
increases. Also, the count of a number of items only increases in the
'compare heap' overview in the NetCFRPM tool, in particular the
Microsoft.AGL.Forms.WnProc and the System.EventHandler and a number of
GUI components.
Now my problem is, I know these issues exist, I just can't trace them
to any particular point in my source code. Is there a better solution
then just 'code inspection' or will I have to hunt through all the
lines of code until I find the source of the problem?
Thanks for any suggestions!
Daan
Date:Thu, 16 Aug 2007 03:39:37 -0700
Author:
|
Re: Memory leaks and how to solve them
There's no CF 2.0 tool that will directly pinpoint where the allocation was
made but not released (though RPM 3.5 also has a profiler tool that will
show this, so installing Studio 2008 beta for this tool might be useful).
It sounds like you are creating a new task list form every time but still
holding some reference to the old one (like in an event handler) so they're
stacking up (no pun intended) in the Heap.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Daan" wrote in message
news:1187260777.952090.105790@k79g2000hse.googlegroups.com...
> Users of the application I have developed report an occasional
> OutOfMemoryException. This prompted me to do some research on memory
> management and related issues and I have learned to use the NetCFRPM
> tool in combination with perfmon.
>
> In my application, there is a task list. When the user clicks on a
> task, the details of this task are shown. Tapping 'back' takes them
> back to the task list. I can see with the tools that every time the
> user views details and goes back, the Managed Bytes Allocated counter
> increases. Also, the count of a number of items only increases in the
> 'compare heap' overview in the NetCFRPM tool, in particular the
> Microsoft.AGL.Forms.WnProc and the System.EventHandler and a number of
> GUI components.
>
> Now my problem is, I know these issues exist, I just can't trace them
> to any particular point in my source code. Is there a better solution
> then just 'code inspection' or will I have to hunt through all the
> lines of code until I find the source of the problem?
>
> Thanks for any suggestions!
> Daan
>
Date:Thu, 16 Aug 2007 09:44:59 -0500
Author:
|
Re: Memory leaks and how to solve them
On 16 aug, 16:44, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
> There's no CF 2.0 tool that will directly pinpoint where the allocation was
> made but not released (though RPM 3.5 also has a profiler tool that will
> show this, so installing Studio 2008 beta for this tool might be useful).
> It sounds like you are creating a new task list form every time but still
> holding some reference to the old one (like in an event handler) so they're
> stacking up (no pun intended) in the Heap.
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Managed Code in an Embedded Worldwww.OpenNETCF.com
>
> "Daan" wrote in message
>
> news:1187260777.952090.105790@k79g2000hse.googlegroups.com...
>
>
>
> > Users of the application I have developed report an occasional
> > OutOfMemoryException. This prompted me to do some research on memory
> > management and related issues and I have learned to use the NetCFRPM
> > tool in combination with perfmon.
>
> > In my application, there is a task list. When the user clicks on a
> > task, the details of this task are shown. Tapping 'back' takes them
> > back to the task list. I can see with the tools that every time the
> > user views details and goes back, the Managed Bytes Allocated counter
> > increases. Also, the count of a number of items only increases in the
> > 'compare heap' overview in the NetCFRPM tool, in particular the
> > Microsoft.AGL.Forms.WnProc and the System.EventHandler and a number of
> > GUI components.
>
> > Now my problem is, I know these issues exist, I just can't trace them
> > to any particular point in my source code. Is there a better solution
> > then just 'code inspection' or will I have to hunt through all the
> > lines of code until I find the source of the problem?
>
> > Thanks for any suggestions!
> > Daan- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
Every time the 'details' view is displayed, 25 new custom controls are
created to display the details of the task. When the 'list' view is
displayed, the panel and any list that contains the 25 custom controls
are cleared. I have tried adding code that removes the event handler
from the items on the panel before clearing the panel.Controls, but
this does not solve the problem. Is there any other way (other then
event handlers) that a reference can still exist to the objects, even
though they are cleared from the panel?
Date:Thu, 16 Aug 2007 14:55:49 -0000
Author:
|
Re: Memory leaks and how to solve them
Are you also calling Dispose on those controls, or on a single parent of
those controls? If not then your app might be holding onto handles.
I have also had problems with OutOfMemoryException.
http://mrpmorris.blogspot.com/2006/12/cf-outofmemory-or-maybe-not.html
Pete
Date:Thu, 16 Aug 2007 21:36:36 +0100
Author:
|
|
|