malloc info

Chris Johns chrisj at rtems.org
Fri Feb 9 00:19:08 UTC 2018


On 09/02/2018 00:59, Mikhail Svetkin wrote:
> Hi all, 
> 
> I am trying to investigate memory leak in my application.
> 
> I check malloc information via malloc_free_space
> and rtems_shell_main_malloc_info and i see after some times that they have
> different results.
> 
> For example:
> rtems_shell_main_malloc_info prints 2mb and malloc_free_space prints 1mb
> 
> Which function should i use?
> 

There is a malloc shell command if you have the shell working or you could call
the shell command directly:

[/] # malloc
C Program Heap and RTEMS Workspace are the same.
Number of free blocks:                             298
Largest free block:                          160667680
Total bytes free:                            160971752
Number of used blocks:                            6707
Largest used block:                           33554440
Total bytes used:                             97291328
Size of the allocatable area in bytes:       258263080
Minimum free size ever in bytes:             160926264
Maximum number of free blocks ever:                314
Maximum number of blocks searched ever:             90
Lifetime number of bytes allocated:         1116295560
Lifetime number of bytes freed:             1019006776
Total number of searches:                     28918650
Total number of successful allocations:       28446143
Total number of failed allocations:                  0
Total number of successful frees:             28439436
Total number of successful resizes:                120

Chris



More information about the users mailing list