JuliaLang/julia — pull request #2706 by KDr2 (2013-03-29 13:57:42+00:00)
Title: GC stats print bugfix (when GC_FINAL_STATS defined)

When ``Julia`` is complied with the macro ``GC_FINAL_STATS`` defined, the function ``print_gc_stats`` is registered as a process atexit hook by ``atexit(3)``. But the function ``uv_atexit_hook()`` who closing ``JL_STDERR`` and ``JL_STDOUT`` runs before ``print_gc_stats``, and ``print_gc_stats`` tries to write data into the closed ``JL_STDERR, JL_STDOUT``. This causes a Segmentation fault.

This commit move ``print_gc_stats`` into ``uv_atexit_hook`` to show the gc stats correctly.