Invoke garbage collector?

Steven Schveighoffer schveiguy at yahoo.com
Thu Feb 10 05:30:01 PST 2011


On Thu, 10 Feb 2011 07:34:53 -0500, spir <denis.spir at gmail.com> wrote:

> On 02/09/2011 10:15 PM, Steven Schveighoffer wrote:
>> On Wed, 09 Feb 2011 15:58:13 -0500, bearophile  
>> <bearophileHUGS at lycos.com> wrote:
>>
>>> Sean Eskapp:
>>>
>>>> so is there a way to invoke a GC cleanup in some way?
>>>
>>> http://www.digitalmars.com/d/2.0/phobos/core_memory.html#minimize
>>
>> This attempts to minimize memory, it does not run a collection cycle (I  
>> don't
>> think anyways). To invoke the GC collector, use:
>>
>> http://www.digitalmars.com/d/2.0/phobos/core_memory.html#collect
>>
>> -Steve
>
> But won't this blindly run a GC cycle? What if all I want is a given  
> thingy's mem to be released, isn't it overkill to call GC.collect?

Then you can free it via:  
http://www.digitalmars.com/d/2.0/phobos/core_memory.html#free

The OP's question was "how do I run the garbage collector".

-Steve


More information about the Digitalmars-d-learn mailing list