Some performance questions

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Feb 3 19:15:54 PST 2009


Jarrett Billingsley wrote:
> On Tue, Feb 3, 2009 at 3:44 PM, Chris Nicholson-Sauls
> <ibisbasenji at gmail.com> wrote:
>> The
>> second reason, is that before every allocation the garbage collector will
>> perform a collection run.  This can actually be disabled (at least in
>> theory) if you plan on doing several allocations in a short period of time,
>> and thereafter re-enabled.
> 
> It should be "before every allocation the garbage collector *may*
> perform a collection run."  If it collected on every allocation it
> would make your program's execution speed next to useless ;)

Well okay, yes, it *may*.  I was in a hurry and trying to be general. 
;)  Chances are, though, that if you are doing so many allocations in a 
short period as to be worried about it, that it probably will.  If I 
remember right, the current GC runs a collection just before requesting 
more heap, so its actually related to the first issue.  (I may well 
remember wrong, its been a very long time since I dove into the GC code.)

-- Chris Nicholson-Sauls


More information about the Digitalmars-d-learn mailing list