MT#55283 use dedicated flag for arena debugging

Change-Id: Ic5d99add7dbea68cf8a167103857c2de2686be7c
pull/2157/merge
Richard Fuchs 1 week ago
parent a4c2b66780
commit 57ee958611

@ -2,9 +2,11 @@
#include "helpers.h"
// set to 0 for alloc debugging, e.g. through valgrind
#define ARENA_MIN_PIECE_LEN 4096
// enable to perform each allocation separately, to make debugging (valgrind...) easier
//#define ARENA_ALLOC_DEBUG
struct arena_piece {
char *tail;
size_t left;
@ -17,7 +19,9 @@ static struct arena_piece *arena_piece_new(size_t size, void *(*alloc_fn)(size_t
struct arena_piece *ret;
size_t alloc_size = size + sizeof(*ret) + ARENA_ALLOC_ALIGN;
#ifndef ARENA_ALLOC_DEBUG
alloc_size = MAX(alloc_size, ARENA_MIN_PIECE_LEN);
#endif
ret = alloc_fn(alloc_size);
if (!ret)
return NULL;

@ -11,6 +11,9 @@
#include "helpers.h"
// enable to perform each allocation separately, to make debugging (valgrind...) easier
//#define BENCODE_ALLOC_DEBUG
#define BENCODE_HASH_BUCKETS 31 /* prime numbers work best */
struct __bencode_hash {

Loading…
Cancel
Save