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 / Performance / July 2005

Tip: Looking for answers? Try searching our database.

Memory Issue?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Justin Lazanowski - 25 Jul 2005 21:44 GMT
I seem to be having some problems with .NET running a garbage collection.

I have setup an application that reads in records from a database into a
dataset. The user needs to modify a group of rows in this dataset, a save
routine is run when they are done with all of their modifications, and the
dataset is passed back to the SQL server.

We aren't talking about lots of rows here. The max selection will be 50K
(which is a lot but nothing obscene)

When I run the app I watch the memory for the application jump from 20MB to
60MB. When I close the child form I get no memory back even though I
specificly call GC.Collect (for testing purposes only) Even after extended
periods the memory is not recycled.

Also when I am closing the forms I am expcitly calling the Dataset.Dispose()
methods as well as any other dispose object that may be unmanaged.

An even bigger memory gain is seen if I run a Crystal Report on an ADO.NET
dataset. up to 120MB, again never to be returned to the OS until the
application is completly shut down.

The problem is that this application will be run on a Windows Terminal
server and if I keep grabbing memory like this and not returning it over
30,40 users I am going to have a big memory problem.

Anyone have any thoughts?

Thanks,

Justin
erick@csharpbox.com - 27 Jul 2005 12:09 GMT
> I seem to be having some problems with .NET running a garbage
> collection.
[quoted text clipped - 3 lines]
> save routine is run when they are done with all of their
> modifications, and the dataset is passed back to the SQL server.

Do you have any serialization involved in grabbing the Dataset? Or plain
adapter.Fill()?

> We aren't talking about lots of rows here. The max selection will be
> 50K (which is a lot but nothing obscene)
> When I run the app I watch the memory for the application jump from
> 20MB to 60MB.

Try running CLR profiler and try to see why this data is being allocated.

>When I close the child form I get no memory back even
> though I specificly call GC.Collect (for testing purposes only) Even
> after extended periods the memory is not recycled.
> Also when I am closing the forms I am expcitly calling the
> Dataset.Dispose() methods as well as any other dispose object that may
> be unmanaged.

Calling Dispose() on the dataset does not do anything in regards to your
data... Dispose() from a DataSet will calll the Component.Dispose() which
doesnt touch any tables or rows.
Are you doing any cross process marshalling of data?

Plain and simple, "longer you keep objects cached in memory, longer the CLR
will take to reclaim memory...more you alocate...CLR will too and faster
than you...". make sure you are not caching large amounts of data longer
than your should.

For debugging purposes, try trimming your workingset to see how much data
may be allocated ahead of you (http://addressof.com/blog/archive/2003/11/19/281.aspx).

Erick Sgarb
Phil Wilson - 29 Jul 2005 16:07 GMT
Make sure you're not running a Debug build.
Make sure you call Dispose (or Close) as soon as you're done with the
objects that implement it (several db-related classes like DataSet, the
adapters, DataTable do). That might help clear any unmanaged content in the
classes.
Signature

Phil Wilson
[Microsoft MVP-Windows Installer]

>I seem to be having some problems with .NET running a garbage collection.
>
[quoted text clipped - 29 lines]
>
> Justin

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.