+ Reply to Thread
Results 1 to 3 of 3

Thread: [D] The GC

  1. #1
    Join Date
    Oct 2008
    Posts
    4,060
    Blog Entries
    6
    Rep Power
    45

    [D] The GC

    In certain portions of code (speed critical bits for example), you wouldn't want the GC
    making a collection. So to overcome this you can disable the garbage collector by using
    this peice of code:
    Code:
    std.gc.disable();
    Once you have disabled it, you must manually re-enable it by having this:
    Code:
    std.gc.enable();
    You can also make it run collections, unlike the Java and .NET GCs, this is not a request
    command, it will force the collection to run:
    Code:
    std.gc.fullCollect();
    That will make a full collection, it will take longer then the second type, but will
    pick up all the "garbage".
    Code:
    std.gc.genCollect();
    This will do a generation collection, which will be faster then a full mark and sweep
    collection, but may not pick up all the "garbage".
    It is important when trying any of these peices of code, that you put this at the top of
    the file:
    Code:
    import std.gc;
    So you have access to the std.gc module.
    Interested in participating in community events?
    Want to harness your programming skill and turn it into absolute prowess?
    Come join our programming events!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: [D] The GC

    Nice bit of info! +rep

  4. #3
    whitey6993's Avatar
    whitey6993 is offline Programming Expert
    Join Date
    Dec 2008
    Posts
    435
    Rep Power
    15

    Re: [D] The GC

    Interesting fact. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts