mirror of
https://github.com/bellard/quickjs.git
synced 2026-06-07 14:42:08 +00:00
use the host malloc() for all allocations when ASAN is enabled
This commit is contained in:
parent
4a13c45081
commit
ecd05ea133
@ -243,6 +243,12 @@ typedef enum OPCodeEnum OPCodeEnum;
|
||||
#define JS_MALLOC_BLOCK_SIZE_COUNT 31
|
||||
#define JS_MALLOC_MIN_SMALL_SIZE 16
|
||||
#define JS_MALLOC_MAX_SMALL_SIZE 512
|
||||
#if defined(__SANITIZE_ADDRESS__)
|
||||
/* use the host malloc() for all allocations */
|
||||
#define JS_MALLOC_LARGE_BLOCKS_ONLY 1
|
||||
#else
|
||||
#define JS_MALLOC_LARGE_BLOCKS_ONLY 0
|
||||
#endif
|
||||
|
||||
/* allow iteration among the allocated blocks. Currently not used. May
|
||||
be used to suppress the memory overhead of JSGCObjectHeader */
|
||||
@ -1547,7 +1553,8 @@ static void *__js_malloc(JSMallocContext *s, size_t size)
|
||||
} else {
|
||||
total_size = ((size + JS_MALLOC_ALIGN - 1) & ~(JS_MALLOC_ALIGN - 1)) +
|
||||
sizeof(JSMallocBlockHeader);
|
||||
if (total_size <= JS_MALLOC_MAX_SMALL_SIZE) { /* TEST */
|
||||
if (!JS_MALLOC_LARGE_BLOCKS_ONLY &&
|
||||
total_size <= JS_MALLOC_MAX_SMALL_SIZE) {
|
||||
int block_size_idx;
|
||||
unsigned int block_idx, block_size;
|
||||
JSMallocBlockHeader *b;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user