Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

Potential memory leak test case #268

@bnoazx005

Description

@bnoazx005

Here is the minimal sample to reproduce the memory leak. When I run the example a new block of memory is allocated almost every few seconds.

marl::Scheduler scheduler(marl::Scheduler::Config::allCores());
scheduler.bind();

while (true)
{
	marl::WaitGroup wg(1);
	marl::schedule([wg]
	{
		std::this_thread::sleep_for(10ms); // some delay to emulate real world load

		marl::WaitGroup nestedWaitGroup(1);
		marl::schedule([nestedWaitGroup]
		{
			std::this_thread::sleep_for(10ms); // some delay to emulate real world load
			nestedWaitGroup.done();
		});

		nestedWaitGroup.wait();

		wg.done();
	});

	wg.wait();
}

/*
Measurements provided with TrackedAllocator per few frames
stats_	{byUsage={ size=6 } }	marl::TrackedAllocator::Stats
byUsage	{ size=6 }	std::array<marl::TrackedAllocator::UsageStats,6>
+		[0]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[1]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[2]	{count=34 bytes=10816 }	marl::TrackedAllocator::UsageStats
+		[3]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[4]	{count=1 bytes=232 }	marl::TrackedAllocator::UsageStats
+		[5]	{count=140 bytes=5984 }	marl::TrackedAllocator::UsageStats


stats_	{byUsage={ size=6 } }	marl::TrackedAllocator::Stats
-		byUsage	{ size=6 }	std::array<marl::TrackedAllocator::UsageStats,6>
+		[0]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[1]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[2]	{count=38 bytes=11072 }	marl::TrackedAllocator::UsageStats
+		[3]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[4]	{count=1 bytes=232 }	marl::TrackedAllocator::UsageStats
+		[5]	{count=146 bytes=6192 }	marl::TrackedAllocator::UsageStats


stats_	{byUsage={ size=6 } }	marl::TrackedAllocator::Stats
-		byUsage	{ size=6 }	std::array<marl::TrackedAllocator::UsageStats,6>
+		[0]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[1]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[2]	{count=38 bytes=11072 }	marl::TrackedAllocator::UsageStats
+		[3]	{count=0 bytes=0 }	marl::TrackedAllocator::UsageStats
+		[4]	{count=1 bytes=232 }	marl::TrackedAllocator::UsageStats
+		[5]	{count=146 bytes=6192 }	marl::TrackedAllocator::UsageStats
*/

Could you explain is my use case incorrect or it's a potential memory leak in library's code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions