Re: cvs.transvirtual.com unreachable and other news

Date view Thread view Subject view Author view

From: Archie Cobbs (archie@whistle.com)
Date: Mon Oct 19 1998 - 14:04:28 EDT


Tim Wilkinson writes:
> kaffe.util.Ptr is used to reference bits of memory allocated by native
> libraries or the underlying system which don't conform to the standard Object
> model and must be explicitly managed - there are plenty of examples with the X
> lib, the zlib and others.
>
> A 'safe' way to do this might be to encapulate these pointers in another final
> class with a finalzier which will always be called then the pointer should be
> freed - but this extra level of indirection is a bit of a hassel.

I guess it depends on what the use of the memory is.

If an instance of kaffe.util.Ptr is for a "special" chunk of memory
(where "special" means not only does the memory pointed to need
to be free'd, but some other thing (like the closing of a file)
needs to happen as well), then it makes sense to use kaffe.util.Ptr
and just make sure that the object containing the reference has
a finalizer that does the right thing.

On the other hand, if the only reason kaffe.util.Ptr is being used
is because some native code allocated a buffer, then byte[] would
seem more appropriate and less memory-leak prone... but I guess
it's up to the developer to make that decision about the extra
overhead incurred.

In any case, can we safely state that all objects that use
kaffe.util.Ptr must have an explicit finalizer?

-Archie

___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:00 EDT