harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [VM]How to trigue GC while free native memory is low.
Date Mon, 05 Feb 2007 10:01:20 GMT
Ivan Volosyuk wrote:
> FreeDirect is quite implementable. It is strange that it is not exist
> in API. May be it is done this way to be conceptually the same as
> ordinary java objects.

I believe the design for NIO buffers is quite nice for the API user --
and leaves the implementers to jump through the hoops, which is arguably
the right way around.

So as a user I can call:
  java.nio.ByteBuffer#allocate(int)   or

(there is a case that the user should not have to decide between direct
or not, but that's how it is)

Then in each case the user can discard the Java object to clean up the
memory.  It is the regular Java object lifecycle in each case, rather
than an alloc/free model, and no opportunity for invalid pointer

In Harmony, ByteBuffer#allocateDirect(int) returns an instance of the
concrete package private type called java.nio.DirectByteBuffer, which
implements #free(), though of course apps cannot call that method
without first casting to the Harmony-specific type.


View raw message