Jim Roskind
unread,Jul 26, 2012, 9:49:07 PM7/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dalec...@chromium.org, Scott Graham, Chromium-dev, Kai Wang
[Comments instigated by Ryan Sleevi pointing out this thread]
The general philosophy for TCMalloc support on Windows was to remove all Windows run-time-library code that called directly (under the covers) into the windows allocator, and then replace it with equivalent code that we directed into the allocator of the day (typically TCMalloc).
In contrast, if you "remove align from the list of removed objects," you have put back in place the Windows flavor. This is generally dangerous, as it *might* call into the Windows allocator. Such calls would probably initialize a pile of stuff, including possibly doing some virtual allocs, and *might* leave us in a messed up situation (at a minimum, with a pile of allocated, but *never* ever used memory).
You found a test that verifies that that if we have an aligned_malloc (as evidenced by a macro define), it is at least sometimes based on calls into functions that we have indeed hooked. Note that it is possible that *sometimes* it calls into (for example) malloc(), which we have nicely hooked, and will safely redirect. It is also possible that sometimes (when the alignment is of a different size? When some allocation is having trouble? other?) that it makes calls into the internals of the windows allocator :-(.
My expectation is that to be safe (you never know what the next flavor of Windows run time library will do!!), you should provide a re-implementation of these functions in our stubs, that are correctly routed to the desired code (depending on whether we set the environment variable one way or another).
I think the place for placing such re-directions and re-implementations is src/base/allocator/allocator_shim.cc
thanks,
Jim