Skip to contentSkip to conversation

memory allocation profiling: the counters are not non-decreasing.

BUG? David Wang 2 participants 3 messages Jun 5, 2024 – Jun 6, 2024

lore
Share & tools
lore

David Wang

author
#0 lore raw

Hi,
I was playing with this new feature of memory allocation profiling, when I plot the data, grouped by caller's source dir, I noticed that the counters are not non-decreasing.
If I understand this feature correctly, all counters should be non-decreasing, right?
Or is there some TTL for stale items?

Following is a simpler script demonstrating my sayings

	$ for i in {1..100}; do sudo cat /proc/allocinfo | grep " mm\/" | awk '{s+=$2}END{print s}'; sleep 10; done
	1194453
	1196935
	1198957
	1199716
	1200770
	1190795  <--- decrease here
	1192702
	1193070
	1193812
	1195069
	1196491
	...

FYI
David

#1 lore raw
Quoted 6 lines · David Wang

Hi,
I was playing with this new feature of memory allocation profiling, when I plot the data, grouped by caller's source dir, I noticed that the counters are not non-decreasing.
If I understand this feature correctly, all counters should be non-decreasing, right?
Or is there some TTL for stale items?

Hi David,
Counters can decrease once an allocation is freed. Thanks,
Suren.

Quoted 20 lines

Following is a simpler script demonstrating my sayings

        $ for i in {1..100}; do sudo cat /proc/allocinfo | grep " mm\/" | awk '{s+=$2}END{print s}'; sleep 10; done
        1194453
        1196935
        1198957
        1199716
        1200770
        1190795  <--- decrease here
        1192702
        1193070
        1193812
        1195069
        1196491
        ...

FYI
David

author
#2 lore raw
Quoted 8 lines · Suren Baghdasaryan
Quoted 6 lines · David Wang

Hi,
I was playing with this new feature of memory allocation profiling, when I plot the data, grouped by caller's source dir, I noticed that the counters are not non-decreasing.
If I understand this feature correctly, all counters should be non-decreasing, right?
Or is there some TTL for stale items?

Quoted 5 lines

Hi David,
Counters can decrease once an allocation is freed. Thanks,
Suren.

Hi Suren,

Thanks for the quick response.
I guess I misunderstood this feature, no wonder I saw several "zero" values.

If "freed" memory is also tracked accurately, I feel this would be a very powerful feature!

Thx~
David

Quoted 20 lines
Quoted 20 lines

Following is a simpler script demonstrating my sayings

        $ for i in {1..100}; do sudo cat /proc/allocinfo | grep " mm\/" | awk '{s+=$2}END{print s}'; sleep 10; done
        1194453
        1196935
        1198957
        1199716
        1200770
        1190795  <--- decrease here
        1192702
        1193070
        1193812
        1195069
        1196491
        ...

FYI
David