Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndris Zeila <andris.zeila@zabbix.com>2013-05-22 14:02:50 +0400
committerAndris Zeila <andris.zeila@zabbix.com>2013-05-22 14:02:50 +0400
commit2943dde551ae5e083017c362a3925ffa5dcf6a15 (patch)
tree2fb5ea62897e5aec5e9cb107954b179819bdc908 /include/memalloc.h
parent6207475f64c301bbdaa4408aa87fbbc99b9cae3e (diff)
.......PS. [ZBXNEXT-322] added 64 bit support to memory allocator
This allows shared memory allocation of 4GB and more (current hard limit is set to 64GB). Also added 'allow out of memory' mode. If shared memory is created with allow_oom flag, then out of memory situation is not treated as critical failure and memory allocators return NULL instead of aborting execution.
Diffstat (limited to 'include/memalloc.h')
-rw-r--r--include/memalloc.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/memalloc.h b/include/memalloc.h
index 432ab365166..19aab382ab0 100644
--- a/include/memalloc.h
+++ b/include/memalloc.h
@@ -28,19 +28,26 @@ typedef struct
void **buckets;
void *lo_bound;
void *hi_bound;
- uint32_t free_size;
- uint32_t used_size;
- uint32_t orig_size;
- uint32_t total_size;
+ zbx_uint64_t free_size;
+ zbx_uint64_t used_size;
+ zbx_uint64_t orig_size;
+ zbx_uint64_t total_size;
int shm_id;
char use_lock;
+
+ /* Continue execution in out of memory situation. */
+ /* Normally allocator forces exit when it runs out of allocatable memory. */
+ /* Set this flag to 1 to allow execution in out of memory situations. */
+ char allow_oom;
+
ZBX_MUTEX mem_lock;
const char *mem_descr;
const char *mem_param;
}
zbx_mem_info_t;
-void zbx_mem_create(zbx_mem_info_t **info, key_t shm_key, int lock_name, size_t size, const char *descr, const char *param);
+void zbx_mem_create(zbx_mem_info_t **info, key_t shm_key, int lock_name, zbx_uint64_t size,
+ const char *descr, const char *param, int allow_oom);
void zbx_mem_destroy(zbx_mem_info_t *info);
#define zbx_mem_malloc(info, old, size) __zbx_mem_malloc(__FILE__, __LINE__, info, old, size)