Skip to content

Commit

Permalink
AllocationListener should be called in BufferLedger#transferBalance(.…
Browse files Browse the repository at this point in the history
…..) (apache#51)
  • Loading branch information
zhztheplayer committed Feb 28, 2022
1 parent 0dcc45c commit 919ee5e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,12 @@ boolean transferBalance(final ReferenceManager targetReferenceManager) {
targetReferenceManager.getAllocator().getName());
}

boolean overlimit = targetAllocator.forceAllocate(memoryChunkManager.getSize());
allocator.releaseBytes(memoryChunkManager.getSize());
long size = memoryChunkManager.getSize();
targetAllocator.getListener().onPreAllocation(size);
boolean overlimit = targetAllocator.forceAllocate(size);
targetAllocator.getListener().onAllocation(size);
allocator.releaseBytes(size);
allocator.getListener().onRelease(size);
// since the transfer can only happen from the owning reference manager,
// we need to set the target ref manager as the new owning ref manager
// for the chunk of memory in MemoryChunkManager
Expand Down

0 comments on commit 919ee5e

Please sign in to comment.