From 08505499d1449f53449e119aefc71324376b348b Mon Sep 17 00:00:00 2001
From: shenxin <shenxin@basic.com>
Date: 星期一, 23 八月 2021 19:40:14 +0800
Subject: [PATCH] 增加BHSubscribeNetTopics、BHQueryTopicAddress接口 修改CMakeLists.txt,增加相应文件到编译中。(需要安装protobuf)
---
src/shm/mm.cpp | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/shm/mm.cpp b/src/shm/mm.cpp
index d7cc375..f23fa08 100644
--- a/src/shm/mm.cpp
+++ b/src/shm/mm.cpp
@@ -113,7 +113,6 @@
newsize = ALIGN(size + (SIZE_T_SIZE << 1) + (PTR_SIZE << 1) );
- //fprintf(stderr, "mm_malloc : size=%u\n", size);
/* Search the free list for a fit */
SemUtil::dec(mutex);
if ((ptr = find_fit(newsize)) != NULL)
@@ -124,6 +123,10 @@
} else {
SemUtil::inc(mutex);
err_msg(0, "mm_malloc : out of memery\n");
+ LoggerFactory::getLogger()->fatal("mm_malloc : out of memery\n");
+ // abort();
+ exit(1);
+
return NULL;
}
@@ -228,6 +231,7 @@
/*
* mm_init - Initialize the memory manager, M unit
+ * @return 鏄惁绗竴娆″垱寤�
*/
bool mm_init(size_t heap_size)
{
@@ -300,16 +304,17 @@
return first;
}
-
+/**
+ * @return 鏄惁鐪熸閿�姣佹垚鍔�
+ */
bool mm_destroy(void) {
struct shmid_ds shmid_ds;
-
SemUtil::dec(mutex);
if(shmctl(shmid, IPC_STAT, &shmid_ds) == 0) {
//LoggerFactory::getLogger()->debug("shm_nattch=%d\n", shmid_ds.shm_nattch);
- // 鍙湁褰撳墠涓�涓繘绋媋ttach鍒板叡浜唴瀛樹笂
+ // 澶氫釜杩涚▼attach鍦ㄥ叡浜唴瀛樹笂
if (shmid_ds.shm_nattch > 1) {
//detache
if (shmdt(shmp) == -1) {
@@ -318,7 +323,7 @@
SemUtil::inc(mutex);
return false;
} else {
-
+ // 鍙湁褰撳墠涓�涓繘绋媋ttach鍒板叡浜唴瀛樹笂
hashtable_destroy(hashtable);
//detache
if (shmdt(shmp) == -1) {
--
Gitblit v1.8.0