DataSet not releasing memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello -

I've developed an application which uses DataSets which are local to
specific methods - so they should go out of scope when the form they are on
is closed. I am finding that while monitoring the memory usage through task
manager, the memory will increase while the dataset is filled, but memory is
never released when the form is closed. Even when using the Dispose() method
of the DataSet, as well as explicitly calling GC.Collect() and
GC.WaitForPendingFinalizers(). After searching the web for hourse, I cannot
find anyone who can solve this problem. Does anyone know how to fix this?

Thanks,

-Peter
 
Hi Fith,

I don't think that Task Manager is a proper tool for monitoring memory
usage.
Instead, try one of the memory profilers - there are free ones:

Allocation Profiler
http://www.gotdotnet.com/Community/...mpleGuid=36A3E666-6877-4C26-B62D-BFD7CB3154AC
Devpartner Community edition
http://www.compuware.com/products/d...mmunity+Edition'&offering=DevPartner&sf=1&p=0

and commercial ones:
AQTime
http://www.automatedqa.com/products/aqtime/index.asp
..NET Memory Profiler
http://www.scitech.se/memprofiler/

And others...
 
I've heard other people say that the 'Mem Usage' is not an accurate view of
the memory usage, but I don't buy that - my application runs increasingly
more slowly every time the DataSet is filled (the task manager's 'Mem Usage'
increases) until the application is virtually unusable. Also, other tasks on
the computer are affected (run slow) at this point. Once I close my
application, all response returns to normal. The memory is definitely being
allocated and not returned, no matter what people say about task manager not
being an accurate measure of memory usage...

I need to know if someone has any knowledge of this issue with DataSet
memory not being released.

Thanks all,

-Peter

Miha Markic said:
Hi Fith,

I don't think that Task Manager is a proper tool for monitoring memory
usage.
Instead, try one of the memory profilers - there are free ones:

Allocation Profiler
http://www.gotdotnet.com/Community/...mpleGuid=36A3E666-6877-4C26-B62D-BFD7CB3154AC
Devpartner Community edition
http://www.compuware.com/products/d...mmunity+Edition'&offering=DevPartner&sf=1&p=0

and commercial ones:
AQTime
http://www.automatedqa.com/products/aqtime/index.asp
..NET Memory Profiler
http://www.scitech.se/memprofiler/

And others...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Fith said:
Hello -

I've developed an application which uses DataSets which are local to
specific methods - so they should go out of scope when the form they are
on
is closed. I am finding that while monitoring the memory usage through
task
manager, the memory will increase while the dataset is filled, but memory
is
never released when the form is closed. Even when using the Dispose()
method
of the DataSet, as well as explicitly calling GC.Collect() and
GC.WaitForPendingFinalizers(). After searching the web for hourse, I
cannot
find anyone who can solve this problem. Does anyone know how to fix this?

Thanks,

-Peter
 
Hi,

I really doubt that DataSet is the culprit.
Why don't you profile your app using one of the mentioned profiles instead
to find the reason?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Fith said:
I've heard other people say that the 'Mem Usage' is not an accurate view
of
the memory usage, but I don't buy that - my application runs increasingly
more slowly every time the DataSet is filled (the task manager's 'Mem
Usage'
increases) until the application is virtually unusable. Also, other tasks
on
the computer are affected (run slow) at this point. Once I close my
application, all response returns to normal. The memory is definitely
being
allocated and not returned, no matter what people say about task manager
not
being an accurate measure of memory usage...

I need to know if someone has any knowledge of this issue with DataSet
memory not being released.

Thanks all,

-Peter

Miha Markic said:
Hi Fith,

I don't think that Task Manager is a proper tool for monitoring memory
usage.
Instead, try one of the memory profilers - there are free ones:

Allocation Profiler
http://www.gotdotnet.com/Community/...mpleGuid=36A3E666-6877-4C26-B62D-BFD7CB3154AC
Devpartner Community edition
http://www.compuware.com/products/d...mmunity+Edition'&offering=DevPartner&sf=1&p=0

and commercial ones:
AQTime
http://www.automatedqa.com/products/aqtime/index.asp
..NET Memory Profiler
http://www.scitech.se/memprofiler/

And others...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Fith said:
Hello -

I've developed an application which uses DataSets which are local to
specific methods - so they should go out of scope when the form they
are
on
is closed. I am finding that while monitoring the memory usage through
task
manager, the memory will increase while the dataset is filled, but
memory
is
never released when the form is closed. Even when using the Dispose()
method
of the DataSet, as well as explicitly calling GC.Collect() and
GC.WaitForPendingFinalizers(). After searching the web for hourse, I
cannot
find anyone who can solve this problem. Does anyone know how to fix
this?

Thanks,

-Peter
 
Fith,

Not any problem, try this

*Disclaimer this is not a sample how to do things*
Sub AddDataset (byval ds as dataset)
static ar as arraylist
ar.add(ds)
End sub

You will see your memory grow and your dataset will not be released, how
many time you try to dispose it or how many time you call the GC. It is just
the way of (wrong) code that does this. Can it be that withouth that you
know have something like this (not this code, like this code) in your
program.

As long as there is a reference to an object than it will not be released.

I hope this helps,

Cor
 
Miha -

I don't want to use the profiler yet, as it looks like it would take a weeks
worth of study just to figure out how to use and interpret it... I don't
have that kind of time.

Anyway, I found that minimizing my app seems to bring the memory reading in
taskmanager way down as well - so it isn't the dataset. I'd like to find out
why this behavior takes place as well now...

-Peter

Miha Markic said:
Hi,

I really doubt that DataSet is the culprit.
Why don't you profile your app using one of the mentioned profiles instead
to find the reason?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Fith said:
I've heard other people say that the 'Mem Usage' is not an accurate view
of
the memory usage, but I don't buy that - my application runs increasingly
more slowly every time the DataSet is filled (the task manager's 'Mem
Usage'
increases) until the application is virtually unusable. Also, other tasks
on
the computer are affected (run slow) at this point. Once I close my
application, all response returns to normal. The memory is definitely
being
allocated and not returned, no matter what people say about task manager
not
being an accurate measure of memory usage...

I need to know if someone has any knowledge of this issue with DataSet
memory not being released.

Thanks all,

-Peter

Miha Markic said:
Hi Fith,

I don't think that Task Manager is a proper tool for monitoring memory
usage.
Instead, try one of the memory profilers - there are free ones:

Allocation Profiler
http://www.gotdotnet.com/Community/...mpleGuid=36A3E666-6877-4C26-B62D-BFD7CB3154AC
Devpartner Community edition
http://www.compuware.com/products/d...mmunity+Edition'&offering=DevPartner&sf=1&p=0

and commercial ones:
AQTime
http://www.automatedqa.com/products/aqtime/index.asp
..NET Memory Profiler
http://www.scitech.se/memprofiler/

And others...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Hello -

I've developed an application which uses DataSets which are local to
specific methods - so they should go out of scope when the form they
are
on
is closed. I am finding that while monitoring the memory usage through
task
manager, the memory will increase while the dataset is filled, but
memory
is
never released when the form is closed. Even when using the Dispose()
method
of the DataSet, as well as explicitly calling GC.Collect() and
GC.WaitForPendingFinalizers(). After searching the web for hourse, I
cannot
find anyone who can solve this problem. Does anyone know how to fix
this?

Thanks,

-Peter
 
Hi Fith,

As I've mentioned before, Task Manager is not the right place to look at
memory usage for .net applications.
The .net memory management is a bit complex and you'll have to read some
articles to understand it.
The golden rule is to Dispose every class that implements IDisposable.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Fith said:
Miha -

I don't want to use the profiler yet, as it looks like it would take a
weeks
worth of study just to figure out how to use and interpret it... I don't
have that kind of time.

Anyway, I found that minimizing my app seems to bring the memory reading
in
taskmanager way down as well - so it isn't the dataset. I'd like to find
out
why this behavior takes place as well now...

-Peter

Miha Markic said:
Hi,

I really doubt that DataSet is the culprit.
Why don't you profile your app using one of the mentioned profiles
instead
to find the reason?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Fith said:
I've heard other people say that the 'Mem Usage' is not an accurate
view
of
the memory usage, but I don't buy that - my application runs
increasingly
more slowly every time the DataSet is filled (the task manager's 'Mem
Usage'
increases) until the application is virtually unusable. Also, other
tasks
on
the computer are affected (run slow) at this point. Once I close my
application, all response returns to normal. The memory is definitely
being
allocated and not returned, no matter what people say about task
manager
not
being an accurate measure of memory usage...

I need to know if someone has any knowledge of this issue with DataSet
memory not being released.

Thanks all,

-Peter

:

Hi Fith,

I don't think that Task Manager is a proper tool for monitoring memory
usage.
Instead, try one of the memory profilers - there are free ones:

Allocation Profiler
http://www.gotdotnet.com/Community/...mpleGuid=36A3E666-6877-4C26-B62D-BFD7CB3154AC
Devpartner Community edition
http://www.compuware.com/products/d...mmunity+Edition'&offering=DevPartner&sf=1&p=0

and commercial ones:
AQTime
http://www.automatedqa.com/products/aqtime/index.asp
..NET Memory Profiler
http://www.scitech.se/memprofiler/

And others...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Hello -

I've developed an application which uses DataSets which are local to
specific methods - so they should go out of scope when the form they
are
on
is closed. I am finding that while monitoring the memory usage
through
task
manager, the memory will increase while the dataset is filled, but
memory
is
never released when the form is closed. Even when using the
Dispose()
method
of the DataSet, as well as explicitly calling GC.Collect() and
GC.WaitForPendingFinalizers(). After searching the web for hourse,
I
cannot
find anyone who can solve this problem. Does anyone know how to fix
this?

Thanks,

-Peter
 
Hello Fith,

Could you please try GC.ReRegisterForFinalize(yourDataSet) right after you
are done with your DataSet?

Thanks
Amir
 
Back
Top