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

Memory Leak in code #131

Open
HITKJ opened this issue Oct 22, 2022 · 3 comments
Open

Memory Leak in code #131

HITKJ opened this issue Oct 22, 2022 · 3 comments

Comments

@HITKJ
Copy link

HITKJ commented Oct 22, 2022

this line would cause memory leak, resulting in "corrupted size vs. prev_size":

hand_type = ann['hand_type']

image

It suppoes to allocate new memory space for handtype like this:

  •    hand_type= ann['hand_type'].lower()
    
@mks0601
Copy link
Collaborator

mks0601 commented Oct 22, 2022

I can't get why it causes memory leak?

@HITKJ
Copy link
Author

HITKJ commented Oct 31, 2022

In python, same string points to the same address, causing whole memory space of ann which reference the string hand_type can't be freed.
annis a variable that takes up a lot of memory space and cannot be freed in each loop. As a result, I got memory leak.
str.lower() will allocate new memory space which is different from ann['hand_type'].

@mks0601
Copy link
Collaborator

mks0601 commented Nov 1, 2022

I see. Thanks for your good tip!

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

2 participants