Re: Memory leak

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Frank Rizzo wrote:
Hello, I have a very frustrating issue I've been working on. I have a routine that does the following:

1. Load a large (declared local to the function) DataSet from the database. It contains 5 tables.
2. Load the database into a fairly complicated object model.
3. I dispose of the Dataset.

Before loading the DataSet the MemUsage column in Task Manager shows 44 MB. After loading the database the MemUsage stands at 59 MB. Thus I assume that the DataSet has about 15 MB of data, which is about right.

I then load the DataSet data into an object model and the MemUsage jumps to 84 MB, thus the object model weighs about 25 MB, which is also about right.

I then dispose of the DataSet, but the MemUsage column does not change. I've tried GC.Collect, GC.WaitForPendingFinalizers, DataSet.Clear, etc... but nothing helps.

Why won't the DataSet release memory? There is a definite leak of 15 MB, which wouldn't be a problem, except that this routine is run by multiple threads, which multiplies the problem quite a bit.

This is VS2003 and .NET 1.1. I've found a discussion where a claim is made by someone else that DataSet doesn't release memory, but nothing specific is offered ( http://www.dotnet247.com/247reference/msgs/35/178959.aspx ). Any guidance on this subject would be appreciated.

Regards.


Have you tried to use the process explorer, http://www.microsoft.com/technet/sysinternals/utilities/ProcessExplorer.mspx

There is a column called private bytes, and you can use that column to track how many memory your application is really using.

The mem usage column used by the task manager is the actual working set size of the process, it includes the shared memory and all the memory used by a lot of system resource. In the .Net case, it includes the memory used by the framework.

HTH.
J.W.
.



Relevant Pages

  • BULK Processing Process "Expires" without completing
    ... I'm going to have more tables to load - I don't want to do what the current ... Is it possible that somehow I'm running out of memory and not completely ... I should also point out that up to now nobody has tried to write packages ... against this database and I'm not completely sure the database is configured ...
    (comp.databases.oracle.server)
  • Re: How big can an array be ?
    ... > Is there any limitation to a PERL array size? ... > If I was to load a MySQL database into an array... ... You probably can't load more into memory than what can be fit ...
    (comp.lang.perl.misc)
  • optimizing memory utilization
    ... "database" for other subsequent processing. ... album ID an the CDDBID. ... When I load into memory, ...
    (comp.lang.python)
  • Re: How to best use Hibernate
    ... Load it all into memory and then synchronize to the database. ... potential of Hibernate, and is the effort managable for lots and lots ...
    (comp.lang.java.programmer)
  • Re: dataset Performence Issue
    ... Microsoft that a DataSet is okay to abuse as a DataBase. ... Managed Code can never be as fast and as optimized ... very good for 90% of the situations i.e. normal memory usage, ... Merge/GetChanges - and oh lets not forget keeping your disconnected cache ...
    (microsoft.public.dotnet.framework.adonet)