Garbage Collection

Discussion in 'C++' started by Lasse Skyum, Oct 20, 2003.

  1. Lasse Skyum

    Lasse Skyum Guest

    Hi folks,

    I've been wanting to write a garbagecollector for C++ for a little while...
    my idea is that all objects inherited from "CGCObject" will be
    garbage-collected if no longer used.

    So all I would have to do is:
    CMyClass *pTest = new CMyClass(); // CMyClass inherits CGCObject

    My aproach has been the "mark and sweep" algorithm, but I haven't been able
    to come up with anything where no additional programming is needed for the
    programs using CGCObject.

    The reason I don't just use reference-counting is because of the possible
    cyclic references holding objects alive even though they should have been
    deleted.


    Can anyone give some hints or references to existing lib's with similar
    functionality?

    --
    Lasse
     
    Lasse Skyum, Oct 20, 2003
    #1
    1. Advertising

  2. Lasse Skyum

    SenderX Guest

    > I've been wanting to write a garbagecollector for C++ for a little
    while...

    Too late!

    The best garbage collected c++ pointer was already designed a long time ago:

    U.S. patent#: 5,295,262


    > My aproach has been the "mark and sweep" algorithm


    Not needed. Ugly schema anyway.


    > The reason I don't just use reference-counting is because of the possible
    > cyclic references holding objects alive even though they should have been
    > deleted.


    Na.


    > Can anyone give some hints or references to existing lib's with similar
    > functionality?


    The one and only lock-free atomic_ptr, created by Joe Seigh:


    The C++ version:

    http://groups.google.com/groups?selm=&rnum=1



    The C version( by me ), with ABA prevention code( by me ):

    http://appcore.home.comcast.net/src/AtomicPtr.c

    This is the best lock-free garbage collector out there. Period!



    P.S.

    Here is my lock-free proxy garbage collector:

    http://intel.forums.liveworld.com/thread.jsp?forum=242&thread=6721

    This 100% lock-free garbage collector is almost as good as atomic_ptr...


    These lock-free collectors are SMP and HyperThread friendly. "mark and
    sweep" is NOT.

    ;)

    --
    The designer of the experimental, SMP and HyperThread friendly, AppCore
    library.

    http://AppCore.home.comcast.net
     
    SenderX, Oct 20, 2003
    #2
    1. Advertising

  3. Lasse Skyum

    Lasse Skyum Guest


    > Too late!

    dahh! I'm always too late... born too young I guess :p


    Thanks for the links, they seem verry usefull!

    --
    Lasse
     
    Lasse Skyum, Oct 20, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laser Lu

    Garbage Collection and Manage Code?

    Laser Lu, Jan 26, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    746
    Gaurav Khanna [C# MVP]
    Jan 27, 2004
  2. Cheung, Jeffrey Jing-Yen
    Replies:
    3
    Views:
    1,588
    Cheung, Jeffrey Jing-Yen
    Jul 10, 2003
  3. IDoNothing

    Garbage Collection in ASP.NET

    IDoNothing, Jan 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    8,414
    cjohn
    Aug 20, 2009
  4. Replies:
    1
    Views:
    468
    mrstephengross
    Jul 25, 2005
  5. Øyvind Isaksen
    Replies:
    1
    Views:
    1,031
    Øyvind Isaksen
    May 18, 2007
Loading...

Share This Page