Jump to content

Calling .net Developers ----- How To Use Dispose Method ?


Jambhalheart

Recommended Posts

how to use dispose method for memory occupied by a DataSet

ds.Dipose() // is marshallbyvaluecomponent and hence it wil not clear memory occupied

ds=null; // means it just references dataset to null but it also doesn't clear memory occupied


then, how to use dispose method (of IDisposable Interface) to clear memory occupied by dataset ??? anybody help plsss

Link to comment
Share on other sites

Oka class teesukoni example chebuta baa.
for example nee Daggara class A unte, now implement iDisposable for that.

Implement chesaka oka destructor raasi Indulo nyvvu aa class lo create chese objects dispose chey. So aa class scope ayipogane autimaticga destructor call ayyi objects free ayipotayi

Link to comment
Share on other sites

[quote name='galigannarao' timestamp='1323272301' post='3158933']
Oka class teesukoni example chebuta baa.
for example nee Daggara class A unte, now implement iDisposable for that.

Implement chesaka oka destructor raasi Indulo nyvvu aa class lo create chese objects dispose chey. So aa class scope ayipogane autimaticga destructor call ayyi objects free ayipotayi
[/quote]



chesaanu mama, kaani its not working.. for ex: I wrote like this in my destructor.


if (_dataset!= null)
dataset.Dispose(); // but memory occupied by dataset is not getting cleared up.


dataset memory ela release cheyalo code oka saari evvu mama pls

Link to comment
Share on other sites

[quote name='Maddy_Rulez' timestamp='1323287469' post='3160154']




chesaanu mama, kaani its not working.. for ex: I wrote like this in my destructor.


if (_dataset!= null)
dataset.Dispose(); // but memory occupied by dataset is not getting cleared up.


dataset memory ela release cheyalo code oka saari evvu mama pls
[/quote]how are you coming to know the memory is cleared or not. Clr nullify the object and wait for the GC action

Link to comment
Share on other sites

[quote name='galigannarao' timestamp='1323288970' post='3160265']
how are you coming to know the memory is cleared or not. Clr nullify the object and wait for the GC action
[/quote]


I m checking in task manager under memory usage , so for every action or event memory is getting increased not decreasing...


edaina code vunte evvu mama, for disposing dataset and releasing dataset memory....

google lo search chesthune vunna, kaani no solution....

Link to comment
Share on other sites

[quote name='Maddy_Rulez' timestamp='1323356161' post='1301113644']



I m checking in task manager under memory usage , so for every action or event memory is getting increased not decreasing...


edaina code vunte evvu mama, for disposing dataset and releasing dataset memory....

google lo search chesthune vunna, kaani no solution....
[/quote]phone nundi dbing evening istale

Link to comment
Share on other sites

[img]http://www.andhrawatch.com/gifs/var/thumbs/Brahmi-Gifs/106kchl.gif?m=1321424381[/img]evado okadu helf seyandi ..ninati nundi kotteskuntundu[img]http://www.andhrawatch.com/gifs/var/thumbs/Brahmi-Gifs/106kchl.gif?m=1321424381[/img]

Link to comment
Share on other sites

[quote name='HS' timestamp='1323357958' post='1301113759']
[img]http://www.andhrawatch.com/gifs/var/thumbs/Brahmi-Gifs/106kchl.gif?m=1321424381[/img]evado okadu helf seyandi ..ninati nundi kotteskuntundu[img]http://www.andhrawatch.com/gifs/var/thumbs/Brahmi-Gifs/106kchl.gif?m=1321424381[/img]
[/quote]

hey, neeku kooda .net vaachu kadha,evado enduku nuvve help cheyochu kadha, evaranna seppandi ra babu [img]http://i40.tinypic.com/bi2tqc.gif[/img]

Link to comment
Share on other sites

[url="http://social.msdn.microsoft.com/forums/en-US/clr/thread/fce08a02-f3dd-4827-82ee-1b4b2309fd80"]http://social.msdn.microsoft.com/forums/en-US/clr/thread/fce08a02-f3dd-4827-82ee-1b4b2309fd80[/url]

link by gannarao ..db access leka naku gtalk lo pm sesadu

Link to comment
Share on other sites

[font=arial, sans-serif][size=3][left]ila kooda cheyochu dataset disposing ani seppu[/left][/size][/font][/left][font=arial, sans-serif][size=3][left]using(DataSet MyDataSet = new DataSet())
{
....
}[/left][/size][/font][/left]

Link to comment
Share on other sites

[quote name='HS' timestamp='1323441503' post='1301119045']
[left]ila kooda cheyochu dataset disposing ani seppu[/left]
[/left][left][font=arial, sans-serif][size=3]using(DataSet MyDataSet = new DataSet())[/size][/font][/left]
[font=arial, sans-serif][size=3]{[/size][/font]
[font=arial, sans-serif][size=3] ....[/size][/font]
[font=arial, sans-serif][size=3]}[/size][/font]
[/left]

[/quote]



ok bro...

I have code like this...


try

{

DataSet ds1 = Presenter.FetchData();// gets data from WCF service

DataSet ds2 = Presenter.FetchData2();// gets data from WCF service

DataSet ds3 = Presenter.FetchData3();// gets data from WCF service

}

catch(Exception ex)
{

}

finally
{

ds1.dispose(); // I m trying to dispose like this but not working...
ds1=null;

ds2.dispose();
ds2=null;

ds3.dispose();
ds3=null;
}




I will try that code , i will let u know the result... thanks to galigannarao and u for code..

Link to comment
Share on other sites

×
×
  • Create New...