bugfixed: can't use global malloc_allocator

remotes/origin/fstore_storage_engine
YuQing 2022-11-19 17:13:02 +08:00
parent 8e4adccb83
commit d07058934b
4 changed files with 32 additions and 20 deletions

View File

@ -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

12
make.sh
View File

@ -53,10 +53,21 @@ 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
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 LIB_VERSION=lib64
fi
else
LIB_VERSION=lib
fi
else else
OS_BITS=32 OS_BITS=32
LIB_VERSION=lib LIB_VERSION=lib
@ -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

View File

@ -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,

View File

@ -53,6 +53,7 @@ struct fast_allocator_array
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 malloc_allocator;
struct fast_allocator_info **allocators; struct fast_allocator_info **allocators;
}; };