all groups > c# > may 2006 >
You're in the

c#

group:

releasing general heap memory allocated to a large array


releasing general heap memory allocated to a large array johnmann56
5/31/2006 10:34:01 PM
c#:
Hello. I have a small C# program which uses a number of large arrays of
double. The program runs fine on my desktop PC which has 2 GB of memory, but
when run on my laptop with 512 MB the laptop practically freezes up, from
running out of memory. I would therefore like to modify my program so that
memory space used by the various arrays can be freed up once I am done with
each array. I have tried many things before calling GC.Collect(), including
setting the array ref to null, setting the array ref to a new, very small
array, putting the array in its own class and instantiating one of these and
expecting it to go out of scope, making a component with the array and
disposing of the component after use. When I watch the memory usage in Task
Manager, it doesn't drop back to the original level until I quit my program
altogether, for any of these attempts.

My question is - how can I force this memory to be freed up? Thanks in
advance.

Re: releasing general heap memory allocated to a large array nidostyle NO[at]SPAM googlemail.com
6/1/2006 12:30:14 AM
Send me your programe i will try.
Re: releasing general heap memory allocated to a large array nidostyle NO[at]SPAM googlemail.com
6/1/2006 12:30:19 AM
Send me your programe i will try.
Re: releasing general heap memory allocated to a large array johnmann56
6/1/2006 2:41:02 AM
It appears that Garbage Collection is suspended while running the program in
Debug mode. I compiled and ran the program in Release and the memory used by
a component was freed after its disposal. Can anyone confirm that VS 2005
suspends garbage collection during Debug running? Thanks.

[quoted text, click to view]
AddThis Social Bookmark Button