mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-31 23:48:19 +03:00
Implement the *allocx() API.
Implement the *allocx() API, which is a successor to the *allocm() API.
The *allocx() functions are slightly simpler to use because they have
fewer parameters, they directly return the results of primary interest,
and mallocx()/rallocx() avoid the strict aliasing pitfall that
allocm()/rallocx() share with posix_memalign(). The following code
violates strict aliasing rules:
foo_t *foo;
allocm((void **)&foo, NULL, 42, 0);
whereas the following is safe:
foo_t *foo;
void *p;
allocm(&p, NULL, 42, 0);
foo = (foo_t *)p;
mallocx() does not have this problem:
foo_t *foo = (foo_t *)mallocx(42, 0);
This commit is contained in:
parent
0ac396a06a
commit
d82a5e6a34
19 changed files with 954 additions and 365 deletions
|
|
@ -1,5 +1,3 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
TEST_BEGIN(test_same_size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue