mirror of
https://github.com/gperftools/gperftools
synced 2025-01-18 04:41:34 +00:00
actually test malloc/free from InitLateMaybeRecursive
This days compilers ~always optimize out free(malloc(N)) to nothing.
This commit is contained in:
parent
a80ce7b0e1
commit
d9b14b9da1
@ -141,12 +141,6 @@ void Static::InitLateMaybeRecursive() {
|
||||
CentralCacheUnlockAll, // parent calls after fork
|
||||
CentralCacheUnlockAll); // child calls after fork
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
// pthread_atfork above may malloc sometimes. Lets ensure we test
|
||||
// that malloc works from here.
|
||||
free(malloc(1));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace tcmalloc
|
||||
|
@ -299,6 +299,12 @@ void ThreadCache::InitModule() {
|
||||
// We do "late" part of initialization without holding lock since
|
||||
// there is chance it'll recurse into malloc
|
||||
Static::InitLateMaybeRecursive();
|
||||
|
||||
#ifndef NDEBUG
|
||||
// pthread_atfork above may malloc sometimes. Lets ensure we test
|
||||
// that malloc works from here.
|
||||
(operator delete)((operator new)(1));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ThreadCache::InitTSD() {
|
||||
|
Loading…
Reference in New Issue
Block a user