Hi, im have a trouble with the memory, my app is to big and it consumes a LOT of memory, i read the posts of dispose in the forum, and all recomends to leave the GC do this work for managed resources, should i dispose the datasets and other graphic objects in my app?

Thanks a lot

Re: Disposing objects by Sunny

Sunny
Thu Jul 22 15:12:29 CDT 2004

If some class implements IDisposable, or has Dispose() or Close(), most
probably this class holds some unmanaged resources and it is recommended
to call Dispose or Close once you are done with it. But I see no reason
to use Dataset.Clear().

Sunny

In article <2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com>,
JMArroyave@discussions.microsoft.com says...
> Hi, im have a trouble with the memory, my app is to big and it consumes a LOT of memory, i read the posts of dispose in the forum, and all recomends to leave the GC do this work for managed resources, should i dispose the datasets and other graphic objects in my app?
>
> Thanks a lot
>

Re: Disposing objects by JMArroyave

JMArroyave
Thu Jul 22 15:24:02 CDT 2004

Hi Sunny, and what about the dataset.dispose

"Sunny" wrote:

> If some class implements IDisposable, or has Dispose() or Close(), most
> probably this class holds some unmanaged resources and it is recommended
> to call Dispose or Close once you are done with it. But I see no reason
> to use Dataset.Clear().
>
> Sunny
>
> In article <2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com>,
> JMArroyave@discussions.microsoft.com says...
> > Hi, im have a trouble with the memory, my app is to big and it consumes a LOT of memory, i read the posts of dispose in the forum, and all recomends to leave the GC do this work for managed resources, should i dispose the datasets and other graphic objects in my app?
> >
> > Thanks a lot
> >
>

Re: Disposing objects by Cowboy

Cowboy
Thu Jul 22 15:37:50 CDT 2004

Using Dispose() is a good practice, as it marks the objects for GC. It will
not automagically clear up memory, but it will help with cleaning up objects
when the GC fires. If you see a Dispose() method (ala the Connection
objects), use it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"JMArroyave" <JMArroyave@discussions.microsoft.com> wrote in message
news:2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com...
> Hi, im have a trouble with the memory, my app is to big and it consumes a
LOT of memory, i read the posts of dispose in the forum, and all recomends
to leave the GC do this work for managed resources, should i dispose the
datasets and other graphic objects in my app?
>
> Thanks a lot



Re: Disposing objects by AlexS

AlexS
Thu Jul 22 17:38:52 CDT 2004

Hi,

you'll be better off if you dispose everything what is IDisposable. And even
much better if you profile app for allocations, for example with
CLRProfiler, which you can get free from MS site.

You might have issues with memory even with code like this:

using (Brush b = new SolidBrush(Color.Black)) {
...some painting
}

If you call this is in loop or you have too many paints you will finish with
thousands of brushes in heap just because GC is not able to collect all
freed ones.

You might want to check also
http://msdn.microsoft.com/architecture/default.aspx?pull=/library/en-us/dnpag/html/scalenet.asp
for additional details on how to deal with GC. But profiler is your best bet
to find what is eating memory and why,

HTH
Alex

"JMArroyave" <JMArroyave@discussions.microsoft.com> wrote in message
news:B57BEBD2-B165-44C7-B1EA-C3DA0D781713@microsoft.com...
> Hi Sunny, and what about the dataset.dispose
>
> "Sunny" wrote:
>
> > If some class implements IDisposable, or has Dispose() or Close(), most
> > probably this class holds some unmanaged resources and it is recommended
> > to call Dispose or Close once you are done with it. But I see no reason
> > to use Dataset.Clear().
> >
> > Sunny
> >
> > In article <2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com>,
> > JMArroyave@discussions.microsoft.com says...
> > > Hi, im have a trouble with the memory, my app is to big and it
consumes a LOT of memory, i read the posts of dispose in the forum, and all
recomends to leave the GC do this work for managed resources, should i
dispose the datasets and other graphic objects in my app?
> > >
> > > Thanks a lot
> > >
> >



Re: Disposing objects by Sunny

Sunny
Thu Jul 22 17:44:49 CDT 2004

Hi,

I do not know the internals of Dataset, so I can not tell you if it uses
some unmanaged resources. But in general, you use IDisposable pattern
when your class holds some unmanaged resources and you want to allow the
user to release them in timely manner.

In most cases, if IDisposable is implemented, it should be called (at
least with the buildin framework classes).

Sunny

In article <B57BEBD2-B165-44C7-B1EA-C3DA0D781713@microsoft.com>,
JMArroyave@discussions.microsoft.com says...
> Hi Sunny, and what about the dataset.dispose
>
> "Sunny" wrote:
>
> > If some class implements IDisposable, or has Dispose() or Close(), most
> > probably this class holds some unmanaged resources and it is recommended
> > to call Dispose or Close once you are done with it. But I see no reason
> > to use Dataset.Clear().
> >
> > Sunny
> >
> > In article <2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com>,
> > JMArroyave@discussions.microsoft.com says...
> > > Hi, im have a trouble with the memory, my app is to big and it consumes a LOT of memory, i read the posts of dispose in the forum, and all recomends to leave the GC do this work for managed resources, should i dispose the datasets and other graphic objects in my app?
> > >
> > > Thanks a lot
> > >
> >
>

Re: Disposing objects by AlexS

AlexS
Thu Jul 22 18:28:12 CDT 2004

DataSet has Dispose method. If object is IDisposable you must Dispose it
after use.

HTH
Alex

"Sunny" <sunny@newsgroups.nospam> wrote in message
news:OqQ4$1DcEHA.3716@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I do not know the internals of Dataset, so I can not tell you if it uses
> some unmanaged resources. But in general, you use IDisposable pattern
> when your class holds some unmanaged resources and you want to allow the
> user to release them in timely manner.
>
> In most cases, if IDisposable is implemented, it should be called (at
> least with the buildin framework classes).
>
> Sunny
>
> In article <B57BEBD2-B165-44C7-B1EA-C3DA0D781713@microsoft.com>,
> JMArroyave@discussions.microsoft.com says...
> > Hi Sunny, and what about the dataset.dispose
> >
> > "Sunny" wrote:
> >
> > > If some class implements IDisposable, or has Dispose() or Close(),
most
> > > probably this class holds some unmanaged resources and it is
recommended
> > > to call Dispose or Close once you are done with it. But I see no
reason
> > > to use Dataset.Clear().
> > >
> > > Sunny
> > >
> > > In article <2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com>,
> > > JMArroyave@discussions.microsoft.com says...
> > > > Hi, im have a trouble with the memory, my app is to big and it
consumes a LOT of memory, i read the posts of dispose in the forum, and all
recomends to leave the GC do this work for managed resources, should i
dispose the datasets and other graphic objects in my app?
> > > >
> > > > Thanks a lot
> > > >
> > >
> >



Re: Disposing objects by Sunny

Sunny
Fri Jul 23 10:21:25 CDT 2004

Did I say something else?


In article <uuqskNEcEHA.2812@TK2MSFTNGP11.phx.gbl>,
salexru2000NO@SPAMsympaticoPLEASE.ca says...
> DataSet has Dispose method. If object is IDisposable you must Dispose it
> after use.
>
> HTH
> Alex
>
> "Sunny" <sunny@newsgroups.nospam> wrote in message
> news:OqQ4$1DcEHA.3716@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > I do not know the internals of Dataset, so I can not tell you if it uses
> > some unmanaged resources. But in general, you use IDisposable pattern
> > when your class holds some unmanaged resources and you want to allow the
> > user to release them in timely manner.
> >
> > In most cases, if IDisposable is implemented, it should be called (at
> > least with the buildin framework classes).
> >
> > Sunny
> >
> > In article <B57BEBD2-B165-44C7-B1EA-C3DA0D781713@microsoft.com>,
> > JMArroyave@discussions.microsoft.com says...
> > > Hi Sunny, and what about the dataset.dispose
> > >
> > > "Sunny" wrote:
> > >
> > > > If some class implements IDisposable, or has Dispose() or Close(),
> most
> > > > probably this class holds some unmanaged resources and it is
> recommended
> > > > to call Dispose or Close once you are done with it. But I see no
> reason
> > > > to use Dataset.Clear().
> > > >
> > > > Sunny
> > > >
> > > > In article <2CE051DC-6B16-4690-B4A5-AD4CDE8C1F01@microsoft.com>,
> > > > JMArroyave@discussions.microsoft.com says...
> > > > > Hi, im have a trouble with the memory, my app is to big and it
> consumes a LOT of memory, i read the posts of dispose in the forum, and all
> recomends to leave the GC do this work for managed resources, should i
> dispose the datasets and other graphic objects in my app?
> > > > >
> > > > > Thanks a lot
> > > > >
> > > >
> > >
>
>
>