In .NET Compact Framework, can I free memory explicitly without waiting for garbage collector to free the memory?

Questions by swaroop

Showing Answers 1 - 30 of 30 Answers

Bala

  • Sep 21st, 2005
 

yes, you can. However you have to explicitly instantiate the Garbage collector and use the collect method.

ajayakumar

  • Oct 4th, 2005
 

yeah we can free memory explicitly

  Was this answer useful?  Yes

sudhakar

  • Oct 7th, 2005
 

Yeah ! You can Explicitly Deallocate the Memory Allocation

  Was this answer useful?  Yes

arun thakur

  • Oct 11th, 2005
 

.NET Compact Framework  come with CLR which perform automatic

garbage collector to free the memory without using destector(perform

garbage collector when is declear)

 

  Was this answer useful?  Yes

rajesh iyer

  • Oct 11th, 2005
 

yes, you can deallocate the memory by calling the finalise method explicitly.

  Was this answer useful?  Yes

hemant

  • Oct 20th, 2005
 

Call Collect() method of Garbage collector class.

Vinoth Kumar A

  • Nov 14th, 2005
 

in vb.net we have explict call Idispoable method to collect the free memory.. the default of the vb.net is finalize method.

  Was this answer useful?  Yes

phanikumar

  • Dec 22nd, 2005
 

<variablename>.dispose() can be used , however the garbage collection happens only when the garbage collector runs within in schedules. only difference is the memory is freed what ever it was allocated except the memory allocated to store object name is still in memory.

moreover its not advisable to call garbage collector to run explicitely as this becomes a performance overhead for the application as well as for the webserver itself.

Bharat Joshi

  • Jan 9th, 2006
 

As far as i know there is not a particular way to realese memory in dotnet although there are destructor(dispose) but they dont invoke when object loose her scope it waits for garbage collector and if we talk about gc.collect() here also the work done by garbage collector

so we can say there is no way to realese meomry explicitly

Rishi

  • Dec 21st, 2006
 

Yes Dude,

it is possible.

Use GC.Collect

  Was this answer useful?  Yes

Karthik D V

  • Apr 20th, 2007
 

Yes you can do that.

If you want to do explicitly, then inherit Dispose interface and implement the Dispose() method.

This method will let you to free the memory by yourself rather than waiting for GC.

  Was this answer useful?  Yes

lakshayhi

  • May 2nd, 2007
 

yes definetly, you can set that object to nothing() but all those guys who are telling you that you can free it by using finalize method its wrong because garbage collection process itself run that method and you dont need to call that method explicitly and moreover dispose method is for resource management and not for deinitializing object. using dispose method you can usedelink that object with all databases and all resources that were there attached with that object , so in my pinion you can derefence that object by setting it to nothing method

  Was this answer useful?  Yes

kiran kumar mellimi

  • May 22nd, 2007
 

yes you can explicitly free the memory with out waiting for garbage collector, inheriting Disposable interface and using dispose method.

  Was this answer useful?  Yes

Surendran

  • May 22nd, 2007
 

GC.Collect();

Collect is a static method so you don't have to instantiate Garbage collector object in order to call Collect method.

  Was this answer useful?  Yes

MagikMan74

  • Jan 27th, 2010
 

Calling the garbage collector does nothing but let the garbage collector know you're ready for it to run. There is no way of forcing it to start as it runs on its own schedule. .Dispose() and == null are the only ways to truly free up resources.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions