mt.mem_alloc size [unit]
mt.mem_free [size] [unit]
mt.mem_used [unit]
mt.mem_rnd_alloc min max total [unit]
mt.mem_test_start min max total min_int max_int total_time
[unit]
mt.mem_test_stop id
mt.mem_test_destroy id
mt.mem_test_destroy_all id
mt.mem_test_list [id] [unit]
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.
This module should never be used in a production environment.
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 2.
Set check_content
at runtime via sercmd
$ sercmd cfg.set_now_int malloc_test check_content 1
Allocates size bytes.
This is a debugging function for simulating memory leaks or stressing the memory allocator. It should not be used in production setups
Allocates the specified number of bytes.
unit
is optional and can be one of:
b - bytes
k - KB
m - MB
g - GB
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
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
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).
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.
Stops the test indentified by id
.
Destroys the test indentified by id
(besides stopping it, it also frees all the data, including the
statistics).
Destroys all the running or stopped tests.
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 13. mt.mem_test_list
usage
$ sercmd 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 }