-
Notifications
You must be signed in to change notification settings - Fork 2
lsan_stats.h
With the functions in this header, all statistics about the allocations can be queried.
Warning
Deprecated since version 1.7: This option is no longer supported.
Will be removed in version 2.
Defaults to false
. Setting it to true
will cause the sanitizer to print the statistics upon normal
termination of the program.
Returns the total count of allocations ever registered by the sanitizer.
Returns the total count of allocated bytes ever registered by the sanitizer.
Returns the total count of freed objects that were previously registered by the sanitizer.
Returns the count of the currently allocated objects registered by the sanitizer.
Returns the count of the currently allocated bytes registered by the sanitizer.
Returns the highest count of objects in the heap at the same time.
Returns the highest count of bytes in the heap at the same time.
Warning
Deprecated: since version 1.5, please refer to __lsan_statsActive
.
Will be removed in version 2.
Returns whether the memory statistics can be queried safely. If it returns false
, but the
memory statistics are queried regardless, the sanitizer might crash.
Note
Added in version 1.1.
Warning
Deprecated: since version 1.5, replaced by __lsan_statsActive
.
Will be removed in version 2.
Abbreviation for __lsan_fragmentationStatsAvailable()
.
Note
Added in version 1.2.
Warning
Deprecated: since version 1.5, replaced by __lsan_statsActive
.
Will be removed in version 2.
Abbreviation for __lsan_fragmentationStatsAvailable()
.
Note
Added in version 1.2.
Warning
Deprecated: since version 1.5, replaced by __lsan_statsActive
.
Will be removed in version 2.
Returns whether the memory fragmentation statistics can be queried safely. If it returns false
,
the statistics can be queried regardless without crash, but they might be wrong.
Note
Added in version 1.2.
Abbreviation for __lsan_printFragmentationStats()
.
Note
Added in version 1.2.
Warning
Deprecated: since version 1.9, replaced by __lsan_printFStats()
and __lsan_printFragmentationStats()
.
Will be removed in version 2.
Abbreviation for __lsan_printFragmentationStats()
.
Note
Added in version 1.2.
Prints the statistics of the memory fragmentation. The bar has a size of 100 characters, it can be
adjusted by using __lsan_printFragmentationWithWidth(size_t)
. The output stream defined by
__lsan_printCout
is used for the printing. The byte amounts are printed human-readable if
__lsan_humanPrint
is set to true
.
This function already checks for the availability of the memory statistics using __lsan_statsActive
and guarantees to not crash the program, even in the case th memory fragmentation statistics are unavailable.
Tip
Example:
Stats of the memory fragmentation so far:
97587 objects in the heap, peek 120463, 415640 deleted objects.
5.49 MiB currently used, peek 7.25 MiB.
[=...................................................=....======.....====.==========================.] of 13.55 MiB total
97587 objects currently in the heap, peek 120463 objects.
[=.=.=.=..=.===..============.........=========.=====================================================] of 122854 objects total
Note
Added in version 1.2.
Abbreviation for __lsan_printFragmentationStatsWithWidth(size_t)
.
Note
Added in version 1.2.
Warning
Deprecated: since version 1.9, replaced by __lsan_printFStatsWithWidth(size_t)
and
__lsan_printFragmentationStatsWithWidth(size_t)
.
Will be removed in version 2.
Abbreviation for __lsan_printFragmentationStatsWithWidth(size_t)
.
Note
Added in version 1.2.
Prints the statistics of the memory fragmentation. The size of the bar is specified by the given argument.
The output stream defined by __lsan_printCout
is used for the printing. The byte amounts are printed
human-readable if __lsan_humanPrint
is set to true
.
This function already checks for the availability of the memory fragmentation statistics using __lsan_statsActive
and guarantees to not crash the program, even in the case the memory fragmentation statistics are unavailable.
Tip
Example with a width of 65
:
Stats of the memory fragmentation so far:
97587 objects in the heap, peek 120463, 415640 deleted objects.
5.49 MiB currently used, peek 7.25 MiB.
[=....................................====...=====================] of 13.55 MiB total
97587 objects currently in the heap, peek 120463 objects.
[===.=..=..========......======.==================================] of 122854 objects total
Note
Added in version 1.2.
Prints the statistics of the allocations. The bar has a size of 100 characters, it can be adjusted by
using __lsan_printStatsWithWidth(size_t)
. The output stream defined by __lsan_printCout
is used for the printing. The byte amounts are printed human-readable if __lsan_humanPrint
is set to true
.
This function already checks for the availability of the memory statistics using __lsan_statsActive
and guarantees to not crash the program, even in the case the memory statistics are unavailable.
Tip
Example:
Stats of the memory usage so far:
297 objects in the heap, peek 661, 485 deleted objects.
7.72 MiB currently used, peek 7.72 MiB.
[====================================================================================================] of 7.72 MiB peek
297 objects currently in the heap, peek 661 objects.
[=============================================.......................................................] of 661 objects peek
Prints the statistics of the allocations. The size of the bar is specified by the given argument. The output
stream defined by __lsan_printCout
is used for the printing. The byte amounts are printed
human-readable if __lsan_humanPrint
is set to true
.
This function already checks for the availability of the memory statistics using __lsan_statsActive
and guarantees to not crash the program, even in the case the memory statistics are unavailable.
Tip
Example with a width of 65
:
Stats of the memory usage so far:
299 objects in the heap, peek 661, 565 deleted objects.
7.72 MiB currently used, peek 7.72 MiB.
[=================================================================] of 7.72 MiB peek
299 objects currently in the heap, peek 661 objects.
[==============================...................................] of 661 objects peek
Copyright (C) 2022 - 2024 mhahnFr.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".