google / tcmalloc

Apache License 2.0
4.31k stars 463 forks source link

Assertion in TCMallocInternalMallocSize #197

Closed icuken closed 3 months ago

icuken commented 1 year ago

Looks like assertion in TCMallocInternalMallocSize is not exactly correct because according to man malloc_usable_size:

If ptr is NULL, 0 is returned.

But the following code crashes:

#include <malloc.h>

#include <iostream>

int main() {
        std::cout << malloc_usable_size(nullptr) << std::endl;

        return 0;
}