mirror of
https://github.com/Stichting-MINIX-Research-Foundation/netbsd.git
synced 2025-09-10 07:39:25 -04:00
80 lines
4.0 KiB
Plaintext
80 lines
4.0 KiB
Plaintext
The following are examples of pl_malloc.d.
|
|
|
|
This is an expiremental script that attepmts to identify who is calling
|
|
malloc() from Perl, and to print byte distribution plots.
|
|
|
|
Here it traces the example program, Code/Perl/func_malloc.pl.
|
|
|
|
# pl_malloc.d -c ./func_malloc.pl
|
|
Function A
|
|
Function B
|
|
Function C
|
|
Tracing... Hit Ctrl-C to end.
|
|
|
|
Perl malloc byte distributions by engine caller,
|
|
|
|
perl`perl_alloc, total bytes = 1
|
|
value ------------- Distribution ------------- count
|
|
0 | 0
|
|
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
|
|
2 | 0
|
|
|
|
libc.so.1`_findbuf, total bytes = 520
|
|
value ------------- Distribution ------------- count
|
|
256 | 0
|
|
512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
|
|
1024 | 0
|
|
|
|
perl`Perl_safesysmalloc, total bytes = 72106
|
|
value ------------- Distribution ------------- count
|
|
1 | 0
|
|
2 |@@ 26
|
|
4 |@@@@@ 72
|
|
8 |@@@@@@ 101
|
|
16 |@@@@@@@@@@@@@@ 216
|
|
32 |@@@@@@@@@@@ 178
|
|
64 |@ 21
|
|
128 | 6
|
|
256 | 2
|
|
512 | 4
|
|
1024 | 1
|
|
2048 |@ 11
|
|
4096 | 1
|
|
8192 | 0
|
|
|
|
|
|
Perl malloc byte distributions by Perl file and subroutine,
|
|
|
|
func_malloc.pl, func_a, bytes total = 42504
|
|
value ------------- Distribution ------------- count
|
|
16384 | 0
|
|
32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
|
|
65536 | 0
|
|
|
|
func_malloc.pl, func_b, bytes total = 100008
|
|
value ------------- Distribution ------------- count
|
|
2 | 0
|
|
4 |@@@@@@@@@@@@@@@@@@@@ 1
|
|
8 | 0
|
|
16 | 0
|
|
32 | 0
|
|
64 | 0
|
|
128 | 0
|
|
256 | 0
|
|
512 | 0
|
|
1024 | 0
|
|
2048 | 0
|
|
4096 | 0
|
|
8192 | 0
|
|
16384 | 0
|
|
32768 | 0
|
|
65536 |@@@@@@@@@@@@@@@@@@@@ 1
|
|
131072 | 0
|
|
|
|
The func_malloc.pl program allocated around 100 Kbytes by creating a
|
|
variable ($b) and populating it with 100,000 "b" characters. This has been
|
|
identified in the last distribution plot printed, with one malloc event
|
|
of between 64 Kbytes and 128 Kbytes in size. There was also a malloc event
|
|
of between 4 and 7 bytes in size.
|
|
|