E2 agent: fix memory leak by not allocating memory
Prior to this commit, the RAN function for KPM is leaking memory: it allocates using calloc() but never frees it. The fix consists of not allocating this memory on the heap in the first place, but on the stack. Therefore, there are changes to pass in a pointer to various functions to the structure on the stack, instead of passing the "container" for the heap memory by value. Further, the MAC was allocating an excessive amount of memory (N times sizeof(NR_UE_info_t)). Instead of copying the entire struct, the present code stores a pointer to the MAC UE container (NR_UE_info_t *). For the RRC, there is a similar simplification that consists in not storing the entire struct f1_ue_data_t (which is not required), but only the RRC UE ID. Note that both MAC and RRC might suffer from race conditions. For the MAC, we should lock the scheduler for the time we read statistics. For the RRC, the problem is more delicate as no mutex exists; the RRC assumes everything is executed synchronously in the ITTI task loop. In both cases, this commit does not address this problem
Showing
Please register or sign in to comment