Re: finalisation

From: skaller (skaller@maxtal.com.au)
Date: Fri Feb 04 2000 - 19:36:20 MET

  • Next message: Damien Doligez: "Re: finalisation"

    Damien Doligez wrote:
    >
    > >From: skaller <skaller@maxtal.com.au>

    > If python specifies reference counting, I guess the only solution is
    > to implement reference counting.

            Python specifically _doesn't_ specify reference counting,
    it specifies garbage collection. But the current implementation
    is deficient in that it uses reference counting. So I need to
    be compatible with existing programs at least as far as preserving
    their correctness provided only that doesn't depend on synchronous
    finalisation (a delay is OK, a change of order may not be).

    >You can use O'Caml's finalisers to
    > help you in the following way:
    >
    > Add a reference count field to each finalisable object. Initialise it
    > to 1 upon allocation and register a finalisation function for this
    > object. Increment the reference count when you create a new reference
    > from another finalised object, and decrement it when you remove a
    > reference (you can do it by simply calling its finalisation function).

            I'm not sure how this works .. a reference from a finalised
    object to another can be indirect (via another object). I'd like to
    avoid
    the cost of maintaining reference counts for non-finalisable objects.

    -- 
    John (Max) Skaller, mailto:skaller@maxtal.com.au
    10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
    homepage: http://www.maxtal.com.au/~skaller
    download: ftp://ftp.cs.usyd.edu/au/jskaller
    



    This archive was generated by hypermail 2b29 : Fri Feb 04 2000 - 19:48:10 MET