8000 Detecting memory leaks in code using libcore · Issue #29 · nextepc/nextepc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Detecting memory leaks in code using libcore #29

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

Open
andrewferguson opened this issue Mar 1, 2021 · 0 comments
Open

Detecting memory leaks in code using libcore #29

andrewferguson opened this issue Mar 1, 2021 · 0 comments

Comments

@andrewferguson
Copy link

I'm working on a research project using some code adapted from NextEPC, in particular the libs1ap and libcore libraries that come bundled with NextEPC. I should add that the NextEPC codebase is really easy to understand and adapt, so many thanks to the whole NextEPC team for this.

Recently I was trying to clean up my code, and reduce memory leaks. I tried to use Valgrind to detect memory leaks, but unfortunately it didn't detect them. The simple example I tried was:

int main() {
  core_initialize();
  char *p;
  p = (char *) core_malloc(19);
  return 0;
}

However, all Valgrind detected was a 74-byte potential leak in core_initialize(), and not the un-free'd core_malloc(19).

I suspect this is due to the way that libcore manages it's own memory with the pkbuf and clbuf structures (which I admit I don't really understand), therefore making it incompatible with regular memory analysis tools such as valgrind.

Given the above, I'm wondering if there is alternative methods to finding memory leaks in code using libcore's memory allocation functions? I saw references to Valgrind in the NextEPC codebase, but I couldn't make those commands work on a default NextEPC installation (I just got lots of references to valgrind itself and bash, with no references to the EPC).

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
0