Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2475 Discussions

Scalable_Malloc not returning memory until out of memory

GnuTu
Beginner
921 Views

Hi there!
I have an issue I can not seem to solve on my own, we are running a game server with thousands of players (on windows server 2022,c++). When these players login they get around 800 "items" added to their character from the database.
We use TBB and scalable_malloc for all our alloc by overriding new and delete with scalable_malloc and scalable_free. We have recently upgraded from a very old TBB I think it was 3.0 to a more modern version from 2019.

Since so many items are created from the database when a player logs in we do the construction of these items in a std::async call. This call has a std::future with a std::vector holding unique_ptrs to the item objects.

This seems to leak, I know tbb will alloc memory and hold it, but it holds so much memory that if we run the server for days it simply runs out of memory (we have one more memory heavy application on the same computer that takes up 30% of the memory). Our player count goes up and down during the day but memory is never given back to the OS.

I have tried to hunt down leaks inside of the factory that creates that item object but found nothing. If I run with std::malloc nothing leaks we can run the server just fine and obviously all memory is instantly given back to the OS correctly. If I run the creation of the items without std::async the memory is given back. I even tried running it as a tbb parallel and that also eats memory just like with async

I have tried running TBBMALLOC_CLEAN_ALL_BUFFERS and TBBMALLOC_CLEAN_THREAD_BUFFERS and a very small amount of memory is returned.

I feel like I am missing something here?

Thanks for your time.

0 Kudos
2 Replies
NoorjahanSk_Intel
Moderator
880 Views

Hi,


Thanks for posting in Intel Communities.


Please try with latest Intel oneTBB version 2021.11 and if you still get the same issue please provide us with below details

1. Sample reproducer code and steps you have followed to reproduce the issue.

2. OS and Hardware details.

Also please let us know how you are observing memory leak.


Thanks & Regards,

Noorjahan.


0 Kudos
NoorjahanSk_Intel
Moderator
811 Views

Hi,


We haven't heard back from you. Could you please provide an update on your issue?


Thanks & Regards,

Noorjahan.


0 Kudos
Reply