内存探测组件,预留热插拔。

This commit is contained in:
1iaan
2026-01-26 13:07:10 +00:00
parent 9e757ece87
commit c99867b342
9 changed files with 187 additions and 37 deletions

View File

@@ -2,6 +2,7 @@
#define __CONFIG_H__
#include <stddef.h>
#include <memory/alloc_dispatch.h>
typedef enum {
LOG_LEVEL_DEBUG,
@@ -19,11 +20,17 @@ typedef enum {
PERSIST_NONE
} PersistenceType;
typedef enum {
ALLOC_JEMALLOC,
ALLOC_MALLOC,
ALLOC_OTHER
} AllocatorType;
// typedef enum {
// ALLOC_JEMALLOC,
// ALLOC_MALLOC,
// ALLOC_MYPOOL,
// ALLOC_OTHER
// } AllocatorType;
// typedef enum {
// MEMLEAK_DETECT_OFF = 0, // 关闭检测
// MEMLEAK_DETECT_ON = 1 // 开启检测
// } MemLeakDetectMode;
typedef struct {
char ip[64];
@@ -43,6 +50,7 @@ typedef struct {
char hash_file[256];
AllocatorType allocator;
MemLeakDetectMode leak_mode;
} AppConfig;
/**
@@ -55,5 +63,6 @@ const char *log_level_to_string(LogLevel lvl);
const char *server_mode_to_string(ServerMode mode);
const char *persistence_to_string(PersistenceType p);
const char *allocator_to_string(AllocatorType a);
const char *leakage_to_string(MemLeakDetectMode a);
#endif /* CONFIG_H */