Xiao-Feng Li wrote: > Since what the ByeBuffer needs are starting address and capacity, it > doesn't really care if this piece of memory is in Java heap or in > native runtime memory ( I assume.) We probably can provide some > special kind of virtual Java object that serves as raw memory block to > nio. In this works, we need not monitor the native runtime memory > usage. > > This approach need certain contract between Java classes and GC about > the special kind of Java object. Probably we can write a layer of Java > class wrapper for raw memory allocation, which hides the contract from > other common classes.
There is a requirement that the 'raw memory block' is pinned though, because addresses in that block may be passed into OS calls (and the point of a direct byte buffer is that the memory is not copied). I don't believe that is going to be a reasonable requirement for all VM implementations. Regards, Tim
