Hi Chris, Comments inline. > So you reallocate all member accesses? That's sounds very > interesting! I haven't had time for taking a look at the code but > I definately will! Yes, I allocate a big chunk of memory for a specific class from offheap by using Unsafe class.This chunk of memory can be defined as an object pool. After pool is allocated, while I getting an instance from this pool, object header and pointer to class definition is initialized for current object block and returns its address.This initialization phase can be done as lazy while getting instance or eager after allocating pool.Advantages of this method are:* Objects are allocated and layout at memory as sequencial and this increases CPU cache hit rate.* There is need for serialization/deserialization, so this helps us to increase performance. > DirectMemory is designed as a cache but not for allocating > complete objects but maybe it could be a nice optional feature. My > problem is: I found out that direct memory access for very short > pieces of data are to costly so I ended up buffering 1K of bytes > before firing them to the native memory location - how do you deal > with this?
As I said above, there is no need for synchronizing data to between heap and native memory location. Because original objects are exist on native memory outside the heap. Developer deals with offheap pool objects like other objects allocated from heap like with "new" keyword or with "Class.newInstance()" reflection call. > This sounds pretty similar to what DM - Lightning does. At the > moment the development of it is a bit fallen asleep but if you're > interested count me :-) Sounds great. I definitely want to work on DM - Lightning project. It is great opportunity for me. Cheers, -- Serkan
