https://bugs.kde.org/show_bug.cgi?id=474856
Bug ID: 474856 Summary: attaching heaptrack to process induces some unwanted side effects on static function pointers Classification: Applications Product: Heaptrack Version: 1.1.0 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: m...@milianw.de Reporter: vincent.lema...@3ds.com Target Milestone: --- Created attachment 161858 --> https://bugs.kde.org/attachment.cgi?id=161858&action=edit code snippet demonstrating the issue SUMMARY After attaching heaptrack to the process, a static function pointer is "redirected" to the heaptrack hook for free() but this pointer doesn't point to libc free() STEPS TO REPRODUCE 1. Compile the attached code snippet with g++ -g -fPIC testfree.cpp -o testfree 2. Run ./testfree 3. Attach heaptrack to testfree process OBSERVED RESULT The output is : testfree now points to heaptrack hook though it wasn't pointing to libc free anymore EXPECTED RESULT I would expect no output since the pointer doesn't point to libc free() anymore (there is therefore no reason why it should point to heaptrack hook), this is a real problem because what you would have allocated with a custom allocator up to the moment heaptrack is attached, will be freed by heaptrack by calling libc free() instead of the custom free() SOFTWARE/OS VERSIONS Observed on Scientific Linux release 7.9 (Nitrogen) ADDITIONAL INFORMATION Of course, removing -fPIC from the compilation option will neutralize heaptrack but we'd like to use it for profiling our custom allocator -- You are receiving this mail because: You are watching all bug changes.