File: README

package info (click to toggle)
kamailio 4.2.0-2%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 56,276 kB
  • sloc: ansic: 552,836; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (284 lines) | stat: -rw-r--r-- 7,206 bytes parent folder | download | duplicates (2)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284

The malloc_test Module

Andrei Pelinescu-Onciul

   iptelorg GmbH

   Copyright  2010 iptelorg GmbH
     _________________________________________________________________

   Table of Contents

   1. Admin Guide

        1. Overview
        2. Parameters

              2.1. check_content

        3. Functions

              3.1. mt_mem_alloc(size)
              3.2. mt_mem_free()

        4. malloc_test RPC Functions

              4.1. mt.mem_alloc size [unit]
              4.2. mt.mem_free [size] [unit]
              4.3. mt.mem_used [unit]
              4.4. mt.mem_rnd_alloc min max total [unit] 
              4.5. mt.mem_test_start min max total min_int max_int
                      total_time [unit] 

              4.6. mt.mem_test_stop id
              4.7. mt.mem_test_destroy id
              4.8. mt.mem_test_destroy_all id
              4.9. mt.mem_test_list [id] [unit]

   List of Examples

   1.1. Set check_content in the config file 
   1.2. Set check_content at runtime via sercmd 
   1.3. men_alloc usage
   1.4. mem_free usage
   1.5. mt.mem_alloc usage
   1.6. mt.mem_free usage
   1.7. mt.mem_used usage
   1.8. mt.mem_rnd_alloc usage
   1.9. mt.mem_test_start usage
   1.10. mt.mem_test_stop usage
   1.11. mt.mem_test_destroy usage
   1.12. mt.mem_test_destroy_all usage
   1.13. mt.mem_test_list usage

Chapter 1. Admin Guide

   Table of Contents

   1. Overview
   2. Parameters

        2.1. check_content

   3. Functions

        3.1. mt_mem_alloc(size)
        3.2. mt_mem_free()

   4. malloc_test RPC Functions

        4.1. mt.mem_alloc size [unit]
        4.2. mt.mem_free [size] [unit]
        4.3. mt.mem_used [unit]
        4.4. mt.mem_rnd_alloc min max total [unit] 
        4.5. mt.mem_test_start min max total min_int max_int total_time
                [unit] 

        4.6. mt.mem_test_stop id
        4.7. mt.mem_test_destroy id
        4.8. mt.mem_test_destroy_all id
        4.9. mt.mem_test_list [id] [unit]

1. Overview

   This  is a debugging/test module. It implements functions (both script
   and  rpcs)  that  can  be used to stress the memory allocator or force
   memory leaks.

Warning

   This module should never be used in a production environment.

2. Parameters

   2.1. check_content

2.1. check_content

   When  doing  the  tests,  check also for the possibility of the memory
   being overwritten. When activated, the allocated memory will be filled
   with a special pattern, that will be checked on free.

   Default: 0 (off).

   It can be changed also at runtime, via the rpc interface.

   Example 1.1.  Set check_content in the config file 
modparam("malloc_test", "check_content", 1)

   Example 1.2.  Set check_content at runtime via sercmd 
$ kamcmd cfg.set_now_int malloc_test check_content 1

3. Functions

   3.1. mt_mem_alloc(size)
   3.2. mt_mem_free()

3.1. mt_mem_alloc(size)

   Allocates size bytes.

Note

   This  is a debugging function for simulating memory leaks or stressing
   the memory allocator. It should not be used in production setups

   Example 1.3. men_alloc usage
...
mem_alloc(1048576); # 1MB
...

3.2. mt_mem_free()

   Frees all the memory allocated with mem_alloc() up to this point.

Note

   This  is a debugging function for simulating memory leaks or stressing
   the memory allocator. It should not be used in production setups

   Example 1.4. mem_free usage
...
mem_free();
...

4. malloc_test RPC Functions

   4.1. mt.mem_alloc size [unit]
   4.2. mt.mem_free [size] [unit]
   4.3. mt.mem_used [unit]
   4.4. mt.mem_rnd_alloc min max total [unit] 
   4.5. mt.mem_test_start min max total min_int max_int total_time [unit]
          
   4.6. mt.mem_test_stop id
   4.7. mt.mem_test_destroy id
   4.8. mt.mem_test_destroy_all id
   4.9. mt.mem_test_list [id] [unit]

4.1.  mt.mem_alloc size [unit]

   Allocates  the  specified number of bytes. unit is optional and can be
   one of:
     * b - bytes
     * k - KB
     * m - MB
     * g - GB

   Example 1.5. mt.mem_alloc usage
 $ kamcmd mt.mem_alloc 10 k

4.2.  mt.mem_free [size] [unit]

   Frees  at  least  size  bytes  from  the  memory  allocated  by  other
   malloc_test functions (e.g. mt.mem_alloc).

   size is optional. If missing, everything will be freed.

   unit is optional and can be one of:
     * b - bytes
     * k - KB
     * m - MB
     * g - GB

   Example 1.6. mt.mem_free usage
 $ kamcmd mt.mem_free 1 m

4.3.  mt.mem_used [unit]

   Returns/displays  how  many  bytes  are allocated. The default unit is
   bytes (for all the possible units see above).

   unit is optional and can be one of:
     * b - bytes
     * k - KB
     * m - MB
     * g - GB

   Example 1.7. mt.mem_used usage
 $ kamcmd mt.mem_used
9221460

4.4. mt.mem_rnd_alloc min max total [unit]

   Allocates  total_size  memory, in pieces of random size between min ..
   max  (inclusive). unit is optional and represents the unit for all the
   given sizes (see above).

   Example 1.8. mt.mem_rnd_alloc usage
 $ kamcmd mt.mem_rnd_alloc 1 64 10240 k

4.5.  mt.mem_test_start min max total min_int max_int total_time [unit]

   Starts  a  malloc  test  that  will take total_time to execute. Memory
   allocations  will  be  performed  at intervals randomly chosen between
   min_int  and  max_int  (in  ms).  Each allocation will have a randomly
   chosen size between min and max unit bytes. After total unit bytes are
   allocated,  everything is released/freed again and the allocations are
   restarted.  All  the  times  are  expressed  in  milliseconds. unit is
   optional and represents the unit for all the given sizes (see above).

   Several tests can be run in parallel.

   Returns the test id.

   Example 1.9. mt.mem_test_start usage
 $ kamcmd mt.mem_test_start 15 64 25000 128 1500 3600000 k
1

4.6.  mt.mem_test_stop id

   Stops the test indentified by id.

   Example 1.10. mt.mem_test_stop usage
 $ kamcmd mt.mem_test_stop 1

4.7.  mt.mem_test_destroy id

   Destroys  the  test  indentified  by  id (besides stopping it, it also
   frees all the data, including the statistics).

   Example 1.11. mt.mem_test_destroy usage
 $ kamcmd mt.mem_test_destroy 1

4.8.  mt.mem_test_destroy_all id

   Destroys all the running or stopped tests.

   Example 1.12. mt.mem_test_destroy_all usage
 $ kamcmd mt.mem_test_destroy_all

4.9.  mt.mem_test_list [id] [unit]

   Returns/displays  data about the test identified by id, or if no id is
   specified, it lists all the tests (running or stopped).

   unit  is optional. The default is is bytes (for all the possible units
   see above).

   Example 1.13. mt.mem_test_list usage
 $ kamcmd mt.mem_test_list
{
        ID           : 2
        run time (s) : 1471
        remaining (s): 2128
        allocations  : 1749
        errors       : 24
        overflows    : 2
        total alloc  : 69614530
        min          : 15360
        max          : 65536
        total        : 25600000
}
{
        ID           : 1
        run time (s) : 3600
        remaining (s): 0
        allocations  : 4268
        errors       : 640
        overflows    : 4
        total alloc  : 144220713
        min          : 15360
        max          : 65536
        total        : 29696000
}