larray
larray copied to clipboard
New memroy laryout for LArray
Here is a brief sketch of a new LArray memory layout:
| header (8 bytes) | (raw memory contents ... ) |
Header describes a memory type (malloc, mmap, NUMA, etc.) and the subsequent array length.
New header format:
memory type (4 bits)
0000: raw memory (malloced. It can be released by Unsafe.freeMemory()) 0001: mmap (no subsequent raw memory contents. Just hold the address of the mmap) 0010: NUMA memory (needs to be deallocated by Numa.free()) 0011 - 1111: (preserved for future use)
memory address (60 bits)
With this change, we no longer need to distinguish various types of memories allocated by LArray, and would simplify the codebase.