Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2dd40d7

Browse files
null77Commit Bot
authored andcommitted
Vulkan: Free pool allocation leak with graph disabled.
Our secondary command buffer pools were leaking memory every submit. This change pops the secondary command buffer pool allocator scope after commands are flushed during a submit. Fixes the memory leak observable on any Vulkan application. Bug: angleproject:4029 Bug: angleproject:4403 Change-Id: I3d0f8d53456336ef0b03c6d37425fb76c88d1551 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057349 Reviewed-by: Jamie Madill <[email protected]> Commit-Queue: Jamie Madill <[email protected]>
1 parent 798a837 commit 2dd40d7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libANGLE/renderer/vulkan/ContextVk.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,8 @@ angle::Result ContextVk::initialize()
721721

722722
if (!commandGraphEnabled())
723723
{
724+
// Push a scope in the pool allocator so we can easily reinitialize on flush.
725+
mPoolAllocator.push();
724726
mOutsideRenderPassCommands.getCommandBuffer().initialize(&mPoolAllocator);
725727
mRenderPassCommands.initialize(&mPoolAllocator);
726728
ANGLE_TRY(startPrimaryCommandBuffer());
@@ -3698,6 +3700,13 @@ angle::Result ContextVk::flushImpl(const vk::Semaphore *signalSemaphore)
36983700
{
36993701
mOutsideRenderPassCommands.flushToPrimary(&mPrimaryCommands);
37003702
ANGLE_TRY(endRenderPass());
3703+
3704+
// Free secondary command pool allocations and restart command buffers with the new page.
3705+
mPoolAllocator.pop();
3706+
mPoolAllocator.push();
3707+
mOutsideRenderPassCommands.reset();
3708+
mRenderPassCommands.reset();
3709+
37013710
ANGLE_VK_TRY(this, mPrimaryCommands.end());
37023711

37033712
Serial serial = getCurrentQueueSerial();

0 commit comments

Comments
 (0)