On Jul 27, 2015, at 2:56 AM, LiHaifeng <[email protected]> wrote:
> It's known that the jemalloc is adopted by Android. Recently I want to dump 
> some jemalloc status information with the thread exit. Fortunately, the 
> function of status dump has been done by jemalloc.
> 
> After tuned the variable of opt_stats_print into true in malloc_init_hard(), 
> the stats_print_atexit() was registered as an hook for atexit(). But, there 
> is nothing status information dumped when the process exit and there is only 
> the warning on the console like below.
> 
> "W/libc    (  859): WARNING: generic atexit() called from legacy shared 
> library"
> 
> So, how to dump the jemalloc status on Android?

There appears to have been some change to glibc within the past two years that 
causes stdin/stdout/stderr to be closed before atexit-registered functions run. 
 To work around this you can directly call malloc_stats_print() directly in 
your application before it exits.  I ran into this a few days ago on an Ubuntu 
15.04 system, and found this related bug report while trying to diagnose the 
issue:

        https://code.google.com/p/address-sanitizer/issues/detail?id=263

Jason
_______________________________________________
jemalloc-discuss mailing list
[email protected]
http://www.canonware.com/mailman/listinfo/jemalloc-discuss

Reply via email to