releasing general heap memory allocated to a large array

G

Guest

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.

John Mann
 
G

Guest

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.
 

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