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

bugfix: KernelPtr objects are owned by the user by default #10

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

stickies-v
Copy link
Owner

Before this commit, KernelPtr objects created through its _from_ptr constructor would not be owned by the user. This is incorrect, in most cases the user is responsible for freeing up these pointers. This bug was introduced by #3, and causes all objects created through the KernelPtr._from_ptr constructor to not be freed by the user, leading to memory leaks such as reported in #9.

Only in the case of callbacks (e.g. for notifications and logging) would the pointer not be owned by the user. However, this usage is currently not implemented.

Fix this by making all KernelPtr objects owned by the user by default (as it was before #3), while still allowing this to be overridden in the future (e.g. when notifications are more fully implemented) through the _from_ptr constructor.

Fixes #9

Before this commit, KernelPtr objects created through its _from_ptr
constructor would not be owned by the user. This is incorrect,
in most cases the user is responsible for freeing up these pointers.

Only in the case of callbacks (e.g. for notifications and logging)
would the pointer not be owned by the user. However, this usage is
currently not implemented.

Fix this by making all KernelPtr objects owned by the user by default,
while still allowing this to be overridden in the future (e.g.
when notifications are more fully implemented) through the _from_ptr
constructor.
Copy link

@ismaelsadeeq ismaelsadeeq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK 309fe70

Thank you for the swift fix @stickies-v

I've tested this branch locally, the memory leak is gone now.

I processed around 300 blocks for this test and the memory usage is very stable from 100 blocks to 300 blocks at less than 1GB.

@stickies-v stickies-v merged commit 596f98a into main Dec 26, 2024
7 checks passed
@stickies-v stickies-v deleted the fix-cleanup branch December 26, 2024 19:30
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

Successfully merging this pull request may close these issues.

Possible Memory leak after calling read_block_from_disk
2 participants