Ok, I looked into approaches of implementation garbage-free nio. Let's 
focus on network communication. For example, for arriving conneciton I have 
to make an instance of socket (my own implementation) that represents a 
connection. Socket is an object and it is not so easy to allocate it 
off-heap. Possibilities I see:

1. Just pooling an object. 
     It is kind of solution but it doesn't seem to be approperiate here.
2. Just treat  a socket (and other objects) as simple struct. We can be 
cunning and allocate chunk of memory with Unsafe.allocateMemory and use it 
as structs storage. But, in that case JVM is not aware of socket object. 

3. Extend JNI interface and try to allocate  natively with malloc (it 
doesn't seems to be very tricky- I could take pattern from alloc_object 
(jni.cpp). Obviously, it is not a solution, it is a workaround. (But, so 
instructive! :) ) 

What do you think? 


-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to