Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential memory leak test case #268

Open
bnoazx005 opened this issue Oct 14, 2024 · 0 comments
Open

Potential memory leak test case #268

bnoazx005 opened this issue Oct 14, 2024 · 0 comments

Comments

@bnoazx005
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant