Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

what Debug.GC does exactly?

Debug Garbage Collector

  • Please log in to reply
1 reply to this topic

#1 jiwonoh

jiwonoh

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 15 February 2013 - 02:45 AM

Hi,

 

I confused that what Debug.GC method does exaclty. I found reference in official site in MF. They described:

 

Runs garbage collection, a service that automatically reclaims unused computer memory.

 

It means when I operate this method, garbage collector pushed to calculate unused memory and dispose it? I already checked it returns free memory, and when it fall down to zero, MemoryOutOfException is occured. I cannot make sure the method is force to GC to work as much as I operate it.

 

Thanks,

from Jiwon.



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 15 February 2013 - 08:57 AM

Hi Jiwon, Debug.GC will force garbage collection. If you call it multiple times, you likely won't see any increase in available memory...since it has already reclaimed the available memory. You should not need to call Debug.GC manually with .NET Micro Framework 4.2 and newer. The runtime will automatically reclaim memory when it runs low. Of course you can still call it if you want to help avoid automatic GC calls during important operations. We typically only ever call Debug.GC to understand how much RAM we have available. Please note that some objects can be pinned in memory. Debug.GC returns the total amount of free RAM--but not necessarily all of it is available as one large contiguous chunk. Chris





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.