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

How to properly release(free) a heap? #342

Open
YuriArthas opened this issue Jul 10, 2024 · 0 comments
Open

How to properly release(free) a heap? #342

YuriArthas opened this issue Jul 10, 2024 · 0 comments

Comments

@YuriArthas
Copy link

I need to release a heap, but the partial_span in the heap is being treated as a cache and is being released using unmap.

I think the partial_span should be retained. In fact, I think when releasing, the heap should be merged into another heap instead of treating partial_span as a cache and placing it in the global cache.
image

The application scenario is: I have many game sessions, each using a heap. When a game ends, the heap is released. The remaining partial_span in the heap needs to be transferred to other heaps.

It is not feasible to simply put the heap into a pool and request a heap for each game session, because the number of game sessions can vary. For example, there might have been 100 game sessions an hour ago, but now there are only 20. In this case, the memory in the 80 heaps would be wasted.

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