Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Discussed here : http://goo.gl/FCkix
- OffHeapMemoryBuffer shouldn't throw a NPE when store function don't
find "goodOne" pointer. Should return null instead to allow
MemoryManagerService to try another buffer if available. See
testAllocateMultipleBuffers function in the attached class :
initializing 4 buffers of 4 bytes, I should be able to store 4 objects
of 4 bytes each.
- OffHeapMemoryBuffer leaks one byte at every allocation. This is
because the pointer is 0 indexed, so a pointer starting at 0 and
ending at 3 is 4 bytes, not 3. See testByteLeaking function :
initializing 1 buffer of 40 bytes, I should be able to store 10
objects of 4 bytes each. I would also suggest to have a function
Pointer.getSize() { return end - start + 1; }
- OffHeapMemoryBuffer.firstMatch should compare pointer capacity to
find a match and not only the ending offset. Doing the correct
comparison will avoid a costly BufferOverflowException.
- OffHeapMemoryBuffer don't report the correct used size (once the
leak is removed) when freeing a pointer. See
testReportCorrectUsedMemory : allocating the whole buffer, freeing a
pointer, reallocating this pointer. The resulting usage should again
be the full buffer.