carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CarbonDataQA <...@git.apache.org>
Subject [GitHub] carbondata pull request #1266: [CARBONDATA-1393] Avoid to throw NPE when exe...
Date Sat, 19 Aug 2017 03:17:19 GMT
Github user CarbonDataQA commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1266#discussion_r134081572
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/memory/UnsafeMemoryManager.java
---
    @@ -105,13 +105,15 @@ private synchronized MemoryBlock allocateMemory(long taskId, long
memoryRequeste
       }
     
       public synchronized void freeMemory(long taskId, MemoryBlock memoryBlock) {
    -    taskIdToMemoryBlockMap.get(taskId).remove(memoryBlock);
    -    allocator.free(memoryBlock);
    -    memoryUsed -= memoryBlock.size();
    -    memoryUsed = memoryUsed < 0 ? 0 : memoryUsed;
    -    LOGGER.info(
    -        "Freeing memory of size: " + memoryBlock.size() + "available memory:  " + (totalMemory
    -            - memoryUsed));
    +    if (taskIdToMemoryBlockMap.containsKey(taskId)) {
    --- End diff --
    
    we cannot just rely on the `taskIdToMemoryBlockMap` , if code requests to clean memoryblock
then we must clean it. so `allocator.free(memoryBlock)` has to be called in all scenarios.
So introduce a boolean flag inside `MemoryBlock` to check already cleaned or not . if it is
not cleaned then clean the block the set the boolean to `true`. Same needs to be added in
`freeMemoryAll` also.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message