Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2841#discussion_r228692328
--- Diff:
core/src/main/java/org/apache/carbondata/core/memory/UnsafeMemoryManager.java
---
@@ -125,13 +117,24 @@ private synchronized MemoryBlock
allocateMemory(MemoryType memoryType, String ta
}
listOfMemoryBlock.add(memoryBlock);
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(String.format("Creating working Memory block (%s)
with size %d."
+ LOGGER.debug(String.format("Creating Offheap working Memory block
(%s) with size %d."
+ " Total memory used %d Bytes, left %d Bytes.",
memoryBlock.toString(), memoryBlock.size(), memoryUsed,
totalMemory - memoryUsed));
}
- return memoryBlock;
+ } else {
+ memoryBlock = MemoryAllocator.HEAP.allocate(memoryRequested);
+ Set<MemoryBlock> listOfMemoryBlock =
taskIdToMemoryBlockMap.get(taskId);
+ if (null == listOfMemoryBlock) {
+ listOfMemoryBlock = new HashSet<>();
+ taskIdToMemoryBlockMap.put(taskId, listOfMemoryBlock);
--- End diff --
Is it required to keep tracking of onheap blocks in map.
---