Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / August 2007

Tip: Looking for answers? Try searching our database.

Memory leaks and how to solve them

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daan - 16 Aug 2007 11:39 GMT
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
<ctacke/> - 16 Aug 2007 15:44 GMT
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.

Signature

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com

> Users of the application I have developed report an occasional
> OutOfMemoryException. This prompted me to do some research on memory
[quoted text clipped - 17 lines]
> Thanks for any suggestions!
> Daan
Daan - 16 Aug 2007 15:55 GMT
> 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
[quoted text clipped - 32 lines]
>
> - 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?
Peter Morris - 16 Aug 2007 21:36 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.