3 ms·
glibc realloc(3) does this on Linux, by way of mremap(2) with MREMAP_MAYMOVE [1]. (Just confirmed on my local machine using strace(1).) Unfortunately, libstdc
by colanderman 4y ago
glibc realloc(3) does this on Linux, by way of mremap(2) with MREMAP_MAYMOVE [1]. (Just confirmed on my local machine using strace(1).)
Unfortunately, libstdc++ does not (to my knowledge) use realloc(3) or mremap(2) for vector resize, nor could it in many situations due to the semantics of C++.
[1] https://github.com/bminor/glibc/blob/15a94e6668a6d7c5697e805d8d67f1d102d0d52e/malloc/malloc.c#L3071-L3072 https://github.com/bminor/glibc/blob/15a94e6668a6d7c5697e805...