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

howto debug memory errors using valgrind+garbage collector #28

Open
jakobkroeker opened this issue Jul 10, 2014 · 2 comments
Open

howto debug memory errors using valgrind+garbage collector #28

jakobkroeker opened this issue Jul 10, 2014 · 2 comments

Comments

@jakobkroeker
Copy link

we should figure out, how to debug memory errors using valgrind+garbage collector,
or is it possible to disable gc?

(recall the bug in ColumnRankProfile, see
https://groups.google.com/forum/#!topic/ffpack-devel/2mwmhJpvQQ4
)
somewhat useful:
GC_DONT_GC environment flag

another helpful way is replacing GC_MALLOC with malloc
using LD_PRELOAD
e.g.

with malloc.c:

#include <stdio.h>
#include <stdlib.h>

void * GC_malloc(size_t a)
{
 // printf("calling my malloc\n");
  return malloc(a);
}

gcc -fPIC -shared malloc.c -o libmygc.so

export LD_PRELOAD = ./libmygc.so

@mikestillman
Copy link
Owner

In order for the e/unit-tests to not use gc (so that valgrind will detect more issues), what is needed?

  1. remove calls to GC_MALLOC, etc. in M2mem-replacement.c
  2. flint needs to be compiled without gc support
  3. use of finalizers in e directory: these functions should be made into no ops.
  4. remove -lgc from the included libraries
  5. remember to add libraries to LD_LIBRARY_PATH (add libraries/final/lib to this list)
  6. initialize factory correctly? (Is something needed here: need to check this)
  7. what else?

@mahrud
Copy link

mahrud commented Aug 21, 2019

With new changes to GC, would be good to document debugging memory issues. One way I've tried is using Flamegraphs: http://www.brendangregg.com/FlameGraphs/memoryflamegraphs.html

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