RESOLVED FIXED 45472
Memory leak in red/black tree
https://bugs.webkit.org/show_bug.cgi?id=45472
Summary Memory leak in red/black tree
Kenneth Russell
Reported 2010-09-09 10:51:54 PDT
While testing the GPU accelerated path rendering code, a memory leak was discovered and tracked down to the fact that the red/black tree was allocating its nodes using operator new directly rather than the arena class.
Attachments
Patch (11.79 KB, patch)
2010-09-09 11:05 PDT, Kenneth Russell
jamesr: review+
kbr: commit-queue-
Kenneth Russell
Comment 1 2010-09-09 11:05:49 PDT
Created attachment 67063 [details] Patch From the ChangeLog: Fixed memory leak in red/black tree where it was using operator new directly to allocate its internal nodes rather than the arena with which it was configured. Added allocateObject variant to arena supporting single-argument constructors. Added test to red/black tree unit tests to cover this functionality, and refactored TrackedAllocator into helper file to share between arena and red/black tree tests.
James Robinson
Comment 2 2010-09-09 11:11:56 PDT
Comment on attachment 67063 [details] Patch Suggestion: ad a private override for operator new on PODRedBlackTree::Node to avoid this sort of bug in the future.
Kenneth Russell
Comment 3 2010-09-09 11:18:01 PDT
(In reply to comment #2) > (From update of attachment 67063 [details]) > Suggestion: ad a private override for operator new on PODRedBlackTree::Node to avoid this sort of bug in the future. This is a good suggestion. I tried it, but unfortunately overriding "void* operator new(size_t size)" on this type prevents placement new from working for the type, which is used by the arena.
Kenneth Russell
Comment 4 2010-09-09 11:21:17 PDT
Note You need to log in before you can comment on or make changes to this bug.