mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-19 17:01:15 +03:00
Generalize isalloc() to handle NULL pointers in such a way that the NULL checking overhead is only paid when introspecting huge allocations (or NULL). This allows free() and malloc_usable_size() to no longer check for NULL. Submitted by Igor Bukanov and Mike Hommey.
19 lines
264 B
C
19 lines
264 B
C
#include <stdio.h>
|
|
#include <assert.h>
|
|
|
|
#define JEMALLOC_MANGLE
|
|
#include "jemalloc_test.h"
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
|
|
fprintf(stderr, "Test begin\n");
|
|
|
|
free(malloc(1));
|
|
free(NULL);
|
|
assert(malloc_usable_size(NULL) == 0);
|
|
|
|
fprintf(stderr, "Test end\n");
|
|
return (0);
|
|
}
|