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 example_tenet #26

Open
synacktiv-rj opened this issue Mar 20, 2023 · 3 comments
Open

Memory leak in example_tenet #26

synacktiv-rj opened this issue Mar 20, 2023 · 3 comments

Comments

@synacktiv-rj
Copy link

Hello,

A memory leak occurs in the loop used to call ttdcursor.ReplayForward, since the caller of Cursor::GetCrossPlatformContext must free the context, and this is never done.

Here, the previous context containing the allocation is overriden without beeing freeed:

old_context = new_context;

My quick fix to deal with this issue was:

if (old_context)
    free(old_context);

I think the context should also be freed when this condition is true:

if (new_context->Rip < addr_min || new_context->Rip >= addr_max)
continue;

Rémi

@mrexodia
Copy link
Contributor

I changed the way the context is allocated in my fork. Still waiting for my other two PRs to be merged though…

@commial
Copy link
Owner

commial commented Aug 5, 2023

Hi there,

@synacktiv-rj: you're obviously right, and I can easily reproduce it when running the example_tenet exe on a ~300MB trace.

@mrexodia : I've indeed been away from this repo for a few month, but I've since merged your cmake PR (thanks, again).
If you still want to contribute to this repo, I would be happy to merge your context allocation changes.

@mrexodia
Copy link
Contributor

mrexodia commented Aug 5, 2023

Alright, I’ll try to upstream them. Locally I started a full rewrite, but obviously life got in the way and it didn’t get very far 😅

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

3 participants