内存探测组件,预留热插拔。
This commit is contained in:
14
kvstore.c
14
kvstore.c
@@ -353,6 +353,7 @@ int init_kvengine(void) {
|
||||
kvs_replay_log(global_cmd_log_fd);
|
||||
}
|
||||
|
||||
printf("kvengine init complete\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -370,10 +371,14 @@ void dest_kvengine(void) {
|
||||
destroy_cmd_log(global_cmd_log_fd);
|
||||
}
|
||||
|
||||
void init_memory_pool(void){
|
||||
void init_memory_pool(AppConfig *cfg){
|
||||
#if MEMORY_SELECT_MALLOC == MEMORY_USE_MYMALLOC
|
||||
mp_create(&global_mempool);
|
||||
#endif
|
||||
kvs_set_memleak_detect(cfg->leak_mode);
|
||||
kvs_set_alloc_type(cfg->allocator);
|
||||
|
||||
printf("mempool init complete\n");
|
||||
}
|
||||
|
||||
void dest_memory_pool(void){
|
||||
@@ -440,7 +445,9 @@ int init_config(AppConfig *cfg){
|
||||
printf("|—— Persist-hash : %s\n", cfg->hash_file);
|
||||
|
||||
printf("Log level : %s\n", log_level_to_string(cfg->log_level));
|
||||
printf("Allocator : %s\n", allocator_to_string(cfg->allocator));
|
||||
printf("Memory : \n");
|
||||
printf("|——Allocator : %s\n", allocator_to_string(cfg->allocator));
|
||||
printf("|——MemLeakDetectMode : %s\n", leakage_to_string(cfg->leak_mode));
|
||||
printf("=============== Config ===============\n");
|
||||
|
||||
xmlCleanupParser();
|
||||
@@ -476,9 +483,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
|
||||
|
||||
init_memory_pool();
|
||||
init_memory_pool(&global_cfg);
|
||||
init_kvengine();
|
||||
|
||||
|
||||
#if (NETWORK_SELECT == NETWORK_REACTOR)
|
||||
reactor_start(port, kvs_protocol, master_ip, master_port); //
|
||||
|
||||
Reference in New Issue
Block a user