Get rid of malloc symbols in libcommon#7065
Conversation
e3dad75 to
7cfce84
Compare
|
One build has failed. |
591130c to
47963f6
Compare
|
@amosbird Can you explain in details what is this fix about and why the issue can't be resolved with typical CMake dependencies and interfaces? Overriding default macro looks very hacky, generally it may lead to new problems, when someone decides to do any refactoring months later. |
|
@abyss7 When doing shared builds, TUs which try to override std symbols (such as malloc or operator new) should be statically linked into the final executable and only be linked once. It includes all unit testing executables. I cannot find easy way of collecting executables in one place other than overriding default macro. |
Thank you for the explanation. The logic is understandable from your changes - but I don't understand the underlying problem. Can you explain why can't we link the |
Most likely because it might fail to load in time upon starting. |
|
Maybe it is dependency issue. If all .so that do malloc/free depend on .so that provide overrides, this .so must be loaded beforehand. |
|
Tbh, I still don't have a clear mind of all other broken cases, but the way in current PR should work. I've asked for a minimal broken example in jemalloc/jemalloc#1636 . Hopefully we can get a better idea of what might go wrong when linking to a DSO containing jemalloc symbols. |
I will make a little investigation today, and will post if I find anything. |
dbms/CMakeLists.txt
Outdated
There was a problem hiding this comment.
What is special about this file so that we need to move it in a separate lib?
CMakeLists.txt
Outdated
There was a problem hiding this comment.
Why not just link clickhouse_new_delete everywhere?
There was a problem hiding this comment.
because clickhouse_new_delete provide operator::new/delete symbol interposition in libcxx/stdlibc++, which is similar to malloc. I'd like to make this strategy consistent.
There was a problem hiding this comment.
why not everywhere
because I assume only executables under dbms require memory tracking.
47963f6 to
08bff17
Compare
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
For changelog. Remove if this is non-significant change.
Category (leave one):