mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 19:55:39 +00:00
0fc58f5ee3
Until rust 1.28, there was no stable way to change the allocator used by rust code. In bug 1280578, we hooked HeadAlloc/HeapFree/HeapRealloc, that the default rust system allocator uses. On other platforms, rust code just ended up using malloc/free/realloc like everything else. As of rust 1.28, though, it is now possible to use the GlobalAlloc trait and the #[global_allocator] attribute to set an allocator. On Windows, this can allow us to hook mozjemalloc directly, rather than using an indirection through HeapAlloc/etc. (which require an extra call to GetProcessHeap), so let's do this. On other platforms, this just ends up doing the same thing as the default rust system allocator (except for the memalign limit on 32-bits platforms). We still need the HeapAlloc/etc. hooks for some C++ code using it, though. Another benefit is that the HeapAlloc GlobalAlloc implementation needs to do its own memalign, which it does by overallocating and aligning manually. We obviously don't need to do this when we using memalign/_aligned_malloc directly. Differential Revision: https://phabricator.services.mozilla.com/D14820 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
dummydll | ||
gtest | ||
rust | ||
dependentlibs.py | ||
gecko.natvis | ||
libxul.so-gdb.py.in | ||
Makefile.in | ||
moz.build | ||
nsDllMain.cpp | ||
StaticXULComponents.ld | ||
symverscript.in | ||
xulrunner.rc |