fast_allocator.[hc]: correct reclaim_interval logic
parent
082a0fbc06
commit
47c4eaeb13
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
Version 1.54 2021-08-06
|
||||
* fast_allocator.[hc]: correct reclaim_interval logic
|
||||
|
||||
Version 1.53 2021-06-30
|
||||
* process_action support action status
|
||||
* uniq_skiplist.h: add function uniq_skiplist_iterator_at
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ void *fast_allocator_alloc(struct fast_allocator_context *acontext,
|
|||
ptr = fast_mblock_alloc_object(&allocator_info->mblock);
|
||||
if (ptr == NULL)
|
||||
{
|
||||
if (acontext->allocator_array.reclaim_interval <= 0)
|
||||
if (acontext->allocator_array.reclaim_interval < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ struct fast_allocator_array
|
|||
{
|
||||
int count;
|
||||
int alloc;
|
||||
int reclaim_interval; //<= 0 for never reclaim
|
||||
int reclaim_interval; //< 0 for never reclaim
|
||||
int last_reclaim_time;
|
||||
volatile int64_t malloc_bytes; //total alloc bytes
|
||||
int64_t malloc_bytes_limit; //water mark bytes for malloc
|
||||
|
|
@ -69,10 +69,10 @@ struct fast_allocator_context
|
|||
|
||||
#define FAST_ALLOCATOR_INIT_REGION(region, _start, _end, _step, _alloc_once) \
|
||||
do { \
|
||||
region.start = _start; \
|
||||
region.end = _end; \
|
||||
region.step = _step; \
|
||||
region.alloc_elements_once = _alloc_once; \
|
||||
(region).start = _start; \
|
||||
(region).end = _end; \
|
||||
(region).step = _step; \
|
||||
(region).alloc_elements_once = _alloc_once; \
|
||||
} while(0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -86,7 +86,7 @@ parameters:
|
|||
mblock_name_prefix: the name prefix of mblock
|
||||
alloc_bytes_limit: the alloc limit, 0 for no limit
|
||||
expect_usage_ratio: the trunk usage ratio
|
||||
reclaim_interval: reclaim interval in second, 0 for never reclaim
|
||||
reclaim_interval: reclaim interval in second, < 0 for never reclaim
|
||||
need_lock: if need lock
|
||||
return error no, 0 for success, != 0 fail
|
||||
*/
|
||||
|
|
@ -103,7 +103,7 @@ parameters:
|
|||
region_count: the region count
|
||||
alloc_bytes_limit: the alloc limit, 0 for no limit
|
||||
expect_usage_ratio: the trunk usage ratio
|
||||
reclaim_interval: reclaim interval in second, 0 for never reclaim
|
||||
reclaim_interval: reclaim interval in second, < 0 for never reclaim
|
||||
need_lock: if need lock
|
||||
return error no, 0 for success, != 0 fail
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue