aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/dtracetoolkit/Examples/pl_malloc_example.txt
blob: a22a0082309db6a52d7cf79f0ad45ae1a27d1146 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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.