-
Notifications
You must be signed in to change notification settings - Fork 189
Fix/memory leak in freelist #56
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
base: master
Are you sure you want to change the base?
Fix/memory leak in freelist #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a memory leak issue in the freelist by implementing proper memory cleanup functionality. The changes introduce methods to reload cache data from files while reusing existing memory and to properly deallocate memory when the cache is no longer needed.
- Add
ReloadFromFilemethod to reset and reload cache without memory leaks - Add
Closemethod to properly deallocate memory at end of cache lifecycle - Modify memory allocation tracking to enable proper cleanup via
clearChunks
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| malloc_mmap.go | Adds tracking of base memory chunks and implements clearChunks for proper memory deallocation |
| malloc_heap.go | Adds no-op clearChunks implementation for heap-based allocation |
| file.go | Modifies load function to accept existing cache for reuse and updates related functions |
| fastcache.go | Implements ReloadFromFile and Close methods on the Cache struct |
This is related to this issue.
Closemethod to make sure that at the end of theCacheobject lifecycle, all memory allocated through the freelist is deallocated