Memory Issues?

J

Justin Lazanowski

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
 
C

Cor Ligthert [MVP]

Justin,

All what you tell does not free any memory.

An object is released if it has not any reference anymore to something or
that there is nothing referencing it anymore.

That is what the GC checks to release it. Calling the GC thousand times does
nothing more than eating processing time, if that condition is not
fullfilled.

(Although you should not rely on the taskmanager the information given in
that says nothing, see some of the messages from Willy in this newsgroup)

http://groups-beta.google.com/group...askmanager&qt_g=1&searchnow=Search+this+group

I hope this helps,

Cor
 
J

Justin Lazanowski

Cor,

Thanks for the info. After reading a bunch of posts in this and the
performance new group I realized I am not the only one to look at this
improperly.

I understand that the GC will collect when it comes down to a memory crunch,
but my specific concern is that this is running on the terminal server. If
each session allocates this memory to itself and does not share it across
the sessions, then 30 users running a 125 in their heap will tie up 3.7Gig I
have 4GB in these terminal servers but that doesn't leave a lot of room.

Anyone have experience with this specific situation?

Also I am calling the dispose and close methods of everything that I can on
the MDIChild close, there are no references to anything in the MDIChild on
the parent.

One other thing that I noticed when I run the Allocation Profiler, is that
there are a lot of assemblies called in the MDI child that are still open
when I close that child.

Is there any way to force these assemblies to unload or does .Net hold them
open for better performance on the next run?

I appreciate the input.

Thanks,
Justin
 
C

Cor Ligthert [MVP]

Justin,

In your case would I make a new question crossposted to this newsgroup, the
newsgroup of your programming language and a kind of terminal server
language.

I would make the subject
"Memory problems with Terminal Server"

Why crossposting to this newsgroup. At least because I am as well interested
in the answers and I am not active in C#.

:)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top