From 090fcc5aae072cf9c45af1a64caa6f48a4c64f95 Mon Sep 17 00:00:00 2001
From: laurent <laurent.thomas@open-cells.com>
Date: Mon, 8 Oct 2018 11:25:16 +0200
Subject: [PATCH] move mem_block to heap

---
 openair2/UTIL/MEM/mem_block.c | 2 ++
 openair2/UTIL/MEM/mem_block.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/openair2/UTIL/MEM/mem_block.c b/openair2/UTIL/MEM/mem_block.c
index 6d1a289f08e..0150ef00cda 100644
--- a/openair2/UTIL/MEM/mem_block.c
+++ b/openair2/UTIL/MEM/mem_block.c
@@ -61,6 +61,7 @@ uint32_t             counters[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 /*
  * initialize all ures
  */
+extern mem_pool  *memBlockVar;
 void           *
 pool_buffer_init (void)
 {
@@ -68,6 +69,7 @@ pool_buffer_init (void)
 
   uint32_t             index, mb_index, pool_index;
   mem_pool       *memory = (mem_pool *) &mem_block_var;
+  memBlockVar=malloc(sizeof(mem_pool));
   int             pool_sizes[14] = { MEM_MNGT_MB0_NB_BLOCKS, MEM_MNGT_MB1_NB_BLOCKS,
                                      MEM_MNGT_MB2_NB_BLOCKS, MEM_MNGT_MB3_NB_BLOCKS,
                                      MEM_MNGT_MB4_NB_BLOCKS, MEM_MNGT_MB5_NB_BLOCKS,
diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h
index 861e4a8ea46..18ded1a5990 100644
--- a/openair2/UTIL/MEM/mem_block.h
+++ b/openair2/UTIL/MEM/mem_block.h
@@ -178,7 +178,8 @@ typedef struct {
 
 } mem_pool;
 
-mem_pool  mem_block_var;
+mem_pool  *memBlockVar;
+#define mem_block_var (*memBlockVar)
 
 #ifdef __cplusplus
 }
-- 
GitLab