-
Notifications
You must be signed in to change notification settings - Fork 3.4k
wrap_dlmalloc #4603
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
wrap_dlmalloc #4603
Conversation
I don't know about this. It adds two exported names to all builds, for a rather corner case, which we already have ways to do (provide a full dlmalloc, e.g. using dlmalloc.c, or use the tracing API). This would also be in danger of breaking should we e.g. switch to the musl allocator instead of separate dlmalloc, which is separate for historic reasons really. |
Hmm, what if we exported the functions as |
Those names sound reasonable to me. Can we do this as an option, though? Exporting them by default all the time sounds like overhead we shouldn't add. Unless this doesn't actually export them unless used? |
Rebased to resolve merge conflict. There is no overhead in always exporting, at least not in added code size, since the symbols will only be linked in if code uses them. And because these are aliases to the same function, if code calls them they will not duplicate the implementation of malloc, but just refer to the original. Or are you concerned with the export table having two extra entries? |
Sounds good about the overhead then. Overall lgtm, except for the idea before to export them as |
…emscripten_builtin_free() so that applications can have an easier mechanism to just hook in between to the existing malloc and free, but still keep calling the original dlmalloc and dlfree. Bump version to 1.36.12.
405f366
to
49674d7
Compare
Oh right, let's do the |
Nice, looks good. |
I just found this. I'd like to use Is there a reason why there isn't also |
It's been a long time - missed this question when it initially was proposed. There was no specific reason not to provide |
Export system malloc() and free() as dlmalloc() and dlfree() so that applications can have an easier mechanism to just hook in between to the existing malloc and free, but still keep calling the original dlmalloc and dlfree.