Memory Usage and Page File Usage - Help! by:RH
|
Hi,
I am building a windows application that has a feature that retrieves a set of records when a button is clicked. When the records are being retrieved I experience a complete system degradation, including other programs that become unresponsive.
Here's what I found while the retrieval process is running:
Using the Windows Task Manager, I can see the the "Page File (PF) Usage" indicator under the Performance tab increase in value from 360 MB to over often over 1 GB when returning 3000-6000 records.
The "Mem Usage" indicator under the Processes tab increases from 40,000K to over 300,000K.
When the operation is done, the memory usage levels remain the same and the response time for my whole computer remains slow. Only until after the application is closed does the memory usage levels go back down and my computer returns to its normal response time.
Also, I'm not sure if this matters but the table that contains these records has a column of type "text" which may contain data in the size of 100-5000 characters.
Any help on what is going on and suggestions on how to fix this would be appreciated. Thanks!
|
| | Reply: by:John J. Hughes II
|
| | You did not say how you were obtaining the data.
My application can put 5000 records of about 300 bytes each from the SQL server on another machine in a few seconds. Text will take longer per records because of the way it's fetched but I have a few windows that display 'ntext' from the SQL and at about 1000 records and 2k size I have not noticed anything like you are talking about.
I don't pay a lot of attention to memory allication but any application written in .NET seems to use more then I am use to. They say the memory is returned but I have noticed this is not very often. My application seems to be pretty good about not allocating more memory if I just reload the new data and dispose of the old so when you hit your peak it should not go above that point. The application I am working on is MDI and basically unless I load an awful lot of records 10K+ with several windows I don't have a memory problem on a system with 1Gig.
You can try calling gagbage disposal if it continues to be a problem.
Sample code might also help someone that knows more about this then I.
Hope this helps, John
|
| | Reply: by:Nicholas Paldino [.NET/C# MVP]
|
| | RH,
I assume you are using a DataSet to store all of this data. Is it really required to have all of that information in memory, or are you processing all of that data and then just letting it go? I can't imagine you binding a UI element to 3000 records.
What are you trying to do that you need all 3000 records in memory at once? -- - Nicholas Paldino [.NET/C# MVP] - mvp@spam.guard.caspershouse.com
|
| | Reply: by:RH
|
| | These records are being stored in a collection and they are not being bound to a UI element. These records contain a column of type "text" that contains XML data which will be parsed later on in the process.
Just now I have modified my code to work with smaller chunks of 500 records at a time instead of the whole lot of 3000+ records. But it made no difference in that after being done with a chunk of 500 records, the memory usage did not reset or clear. Instead, it grew every time a new chuck of records were being processed.
Any suggestions? Is there a way to explicity release the data in memory once the code is done with it?
Thanks in advance.
|
| | Reply: by:John J. Hughes II
|
| | See the System.GC class to clear memory.
Regards, John
|
0 Comments:
Post a Comment
<< Home