bugfixed: can't use global malloc_allocator
parent
8e4adccb83
commit
d07058934b
3
HISTORY
3
HISTORY
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
Version 1.64 2022-11-10
|
Version 1.64 2022-11-19
|
||||||
* shared_func.[hc]: normalize_path use type string_t for general purpose
|
* shared_func.[hc]: normalize_path use type string_t for general purpose
|
||||||
* bugfixed: common_blocked_queue_[alloc|free]_node must use lock
|
* bugfixed: common_blocked_queue_[alloc|free]_node must use lock
|
||||||
|
* bugfixed: can't use global malloc_allocator
|
||||||
|
|
||||||
Version 1.63 2022-10-16
|
Version 1.63 2022-10-16
|
||||||
* sockopt.[hc]: getIpAndPort support ipv6
|
* sockopt.[hc]: getIpAndPort support ipv6
|
||||||
|
|
|
||||||
24
make.sh
24
make.sh
|
|
@ -53,19 +53,30 @@ done
|
||||||
|
|
||||||
/bin/rm -f a.out $tmp_src_filename
|
/bin/rm -f a.out $tmp_src_filename
|
||||||
|
|
||||||
|
uname=$(uname)
|
||||||
TARGET_PREFIX=$DESTDIR/usr
|
TARGET_PREFIX=$DESTDIR/usr
|
||||||
if [ "$int_bytes" -eq 8 ]; then
|
if [ "$int_bytes" -eq 8 ]; then
|
||||||
OS_BITS=64
|
OS_BITS=64
|
||||||
LIB_VERSION=lib64
|
if [ $uname = 'Linux' ]; then
|
||||||
|
osname=$(cat /etc/os-release | grep -w NAME | awk -F '=' '{print $2;}' | \
|
||||||
|
awk -F '"' '{if (NF==3) {print $2} else {print $1}}' | awk '{print $1}')
|
||||||
|
if [ $osname = 'Ubuntu' -o $osname = 'Debian' ]; then
|
||||||
|
LIB_VERSION=lib
|
||||||
|
else
|
||||||
|
LIB_VERSION=lib64
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LIB_VERSION=lib
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
OS_BITS=32
|
OS_BITS=32
|
||||||
LIB_VERSION=lib
|
LIB_VERSION=lib
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$off_bytes" -eq 8 ]; then
|
if [ "$off_bytes" -eq 8 ]; then
|
||||||
OFF_BITS=64
|
OFF_BITS=64
|
||||||
else
|
else
|
||||||
OFF_BITS=32
|
OFF_BITS=32
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEBUG_FLAG=0
|
DEBUG_FLAG=0
|
||||||
|
|
@ -101,7 +112,6 @@ elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then
|
||||||
if [ "$uname" = "Darwin" ]; then
|
if [ "$uname" = "Darwin" ]; then
|
||||||
CFLAGS="$CFLAGS -DDARWIN"
|
CFLAGS="$CFLAGS -DDARWIN"
|
||||||
TARGET_PREFIX=$TARGET_PREFIX/local
|
TARGET_PREFIX=$TARGET_PREFIX/local
|
||||||
LIB_VERSION=lib
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /usr/include/sys/vmmeter.h ]; then
|
if [ -f /usr/include/sys/vmmeter.h ]; then
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@
|
||||||
|
|
||||||
#define BYTES_ALIGN(x, pad_mask) (((x) + pad_mask) & (~pad_mask))
|
#define BYTES_ALIGN(x, pad_mask) (((x) + pad_mask) & (~pad_mask))
|
||||||
|
|
||||||
static struct fast_allocator_info malloc_allocator;
|
|
||||||
|
|
||||||
#define ADD_ALLOCATOR_TO_ARRAY(acontext, allocator, _pooled) \
|
#define ADD_ALLOCATOR_TO_ARRAY(acontext, allocator, _pooled) \
|
||||||
do { \
|
do { \
|
||||||
(allocator)->index = acontext->allocator_array.count; \
|
(allocator)->index = acontext->allocator_array.count; \
|
||||||
|
|
@ -341,7 +339,9 @@ int fast_allocator_init_ex(struct fast_allocator_context *acontext,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_ALLOCATOR_TO_ARRAY(acontext, &malloc_allocator, false);
|
ADD_ALLOCATOR_TO_ARRAY(acontext, &acontext->
|
||||||
|
allocator_array.malloc_allocator, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
logInfo("sizeof(struct fast_allocator_wrapper): %d, allocator_array count: %d",
|
logInfo("sizeof(struct fast_allocator_wrapper): %d, allocator_array count: %d",
|
||||||
(int)sizeof(struct fast_allocator_wrapper), acontext->allocator_array.count);
|
(int)sizeof(struct fast_allocator_wrapper), acontext->allocator_array.count);
|
||||||
|
|
@ -414,7 +414,7 @@ static struct fast_allocator_info *get_allocator(struct fast_allocator_context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &malloc_allocator;
|
return &acontext->allocator_array.malloc_allocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fast_allocator_retry_reclaim(struct fast_allocator_context *acontext,
|
int fast_allocator_retry_reclaim(struct fast_allocator_context *acontext,
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,15 @@ struct fast_region_info
|
||||||
|
|
||||||
struct fast_allocator_array
|
struct fast_allocator_array
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
int alloc;
|
int alloc;
|
||||||
int reclaim_interval; //< 0 for never reclaim
|
int reclaim_interval; //< 0 for never reclaim
|
||||||
int last_reclaim_time;
|
int last_reclaim_time;
|
||||||
volatile int64_t malloc_bytes; //total alloc bytes
|
volatile int64_t malloc_bytes; //total alloc bytes
|
||||||
int64_t malloc_bytes_limit; //water mark bytes for malloc
|
int64_t malloc_bytes_limit; //water mark bytes for malloc
|
||||||
double expect_usage_ratio;
|
double expect_usage_ratio;
|
||||||
struct fast_allocator_info **allocators;
|
struct fast_allocator_info malloc_allocator;
|
||||||
|
struct fast_allocator_info **allocators;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fast_allocator_wrapper {
|
struct fast_allocator_wrapper {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue