PelionIoT / nanostack-libservice

Other
2 stars 11 forks source link

Added dynamic memory tracker and hooks to dynmem library #93

Closed mikaleppanen closed 3 years ago

mikaleppanen commented 3 years ago

NS dynamic memory tracker tracks memory allocations. It has following interface:

ns_dyn_mem_tracker_lib_alloc: is called on alloc

ns_dyn_mem_tracker_lib_free: is called on free

ns_dyn_mem_tracker_lib_step: updates the lifetime of individual memory blocks, and it used to detected which blocks are permanent and which have been allocated lately

ns_dyn_mem_tracker_lib_allocator_lists_update: updates allocator lists, there are lists for top allocators, permanent allocators and allocators going to permanent allocators list

ns_dyn_mem_tracker_lib_max_snap_shot_update: can be used to update memory maximum usage snap shot, this can be called on alloc if snap shot is needed

mikaleppanen commented 3 years ago

I'll still make optimizations at least to list for loops etc. but main structure / interface should be here.