carbondata-issues mailing list archives

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

    https://github.com/apache/carbondata/pull/1266#discussion_r134106795
  
    --- 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 --
    
    In method 'freeMemoryAll', all memoryBlocks belongs to taskId will be freed by allocator,
if taskIdToMemoryBlockMap.containsKey(taskId) == false, it means that  all memoryBlocks belongs
to this taskId were freed, so we don't need to free memoryBlock again.


---
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