Charles Forsyth <charles.fors...@gmail.com> wrote: |On 7 November 2014 10:57, Steffen Nurpmeso <sdao...@yandex.com> wrote: | |> Safety against asynchronous un-/registration can't be it, anyway. | |No, there's a lock. I meant avoiding too many possible interactions between
I thought more about reentrancy because he referred to Linux. But of course you're right. |low-level run-time |functions and the rest of the library. (I'd consider atexit and exit to be |lower-level functions than malloc.) I do not really agree for the highly integrated and portable solution that i worked with, it was just fine there and splitted into normal and final handlers. But.. |Since atexit is already used by profile, and is called by _profmain, which |is called very early on, |putting a call to malloc in that chain means you have to think that much |harder about interactions that are already quite subtle. |Note that _profmain allocates its memory directly using sbrk, probably for |that reason. |Suppose I later want to add a malloc profiler, can I call atexit to write |the results, or not? It seems you can add an atom and it works without spending any further thought. That is cool. --steffen