[ JIRA Id - ODUHIGH-606 ] Fixing null memory size allocation issue
[o-du/l2.git] / src / 5gnrrlc / rlc_utils.h
index 5ec43d4..dfdc312 100755 (executable)
@@ -104,6 +104,15 @@ extern "C" {
  *                              Memory related Defines 
  ******************************************************************************/
 /* Allocate function */
+#ifdef MEM_SIZE_CHECK
+#define RLC_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \
+{\
+   DU_LOG("\nRLC line = %d, func = %s, _size= %d ", _line, _func, _size); \
+}
+#else
+#define RLC_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {}
+#endif
+
 #ifdef ODU_MEMORY_DEBUG_LOG
 #define RLC_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\
 {\
@@ -116,6 +125,7 @@ extern "C" {
 
 #define RLC_ALLOC(_cb,_buf, _size)                                    \
 {                                                                    \
+   RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
  if (SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf,      \
                 (Size) _size) == ROK)                                \
    {                                                                 \
@@ -162,6 +172,7 @@ extern "C" {
 
 #define RLC_ALLOC_SHRABL_BUF_WC(_region, _pool,_buf, _size)           \
 {                                                                    \
+   RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
    if(SGetStaticBuffer(_region, _pool, (Data **)&_buf,                    \
             (Size) _size, 0)==ROK)                                    \
    {\
@@ -175,6 +186,7 @@ extern "C" {
 
 #define RLC_ALLOC_SHRABL_BUF(_region, _pool,_buf, _size)              \
 {                                                                    \
+   RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
  if (SGetStaticBuffer(_region, _pool, (Data **)&_buf,                \
                 (Size) _size, 0) == ROK)                                \
    {                                                                 \
@@ -189,6 +201,7 @@ extern "C" {
 
 #define RLC_ALLOC_WC(_cb,_buf, _size)  \
 {\
+   RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
    if(SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, (Size) _size) == ROK)\
    {\
       RLC_MEM_LOG("RLC,ALLOC_WC", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\
@@ -270,6 +283,7 @@ extern "C" {
 
 #define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
 {                                                                        \
+   RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \
    SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
          (Size) _size, 0);                                        \
    RLC_MEM_LOG("RLC,SHRABL_STATIC_BUF_ALLOC", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\