|
There are two types of memory allocation request in the DRS code, one allocates memory
permanently (i.e. that memory will never be free'd) and the other allocates memory
temporarily (i.e. the memory may be free'd sometime in the future). Both types of
allocation come out of the same contiguious heap. When memory is free'd it isn't
returned to the heap instead its put on a list (several lists actually based on its
size), the temporary memory allocator first attempts to satisfy a request from this
list before allocating it from heap.
The following variables are used to keep track of the heap, I need to describe them
here to make the numbers below make sense.
LOMEM - Address of first byte of heap memory
TPMEM - Address of last byte of heap memory
BTMEM - Address of first byte of unallocated heap. This variable starts out
equal to LOMEM and as heap is allocated to grows towards TPMEM. This
variable *never* decrements (since memory is never returned to heap,
free'd memory being kept on the lookaside lists).
FRMEM - Count of the number of bytes of heap that are free. This value is
decremented each time memory is allocated from the heap, it never
increments.
PRMEM - Count of the number of bytes of heap which have been allocated by the
permanent memory allocator. This value never decrements.
OK so what do the numbers represent ...
>*mem
>Number of bytes: Busy = 14408, Idle = 2832, Free = 1962915
Idle = number of bytes referenced by the lookaside lists. So this represents
memory that was allocated from the heap by the temporary memory
allocator and has subsequently been returned to pool and is available
for re-allocation as temporary memory. This is calculated by adding
up all the memory blocks in the lookaside list.
Busy = number of bytes of heap in currently in use.
This is calculated as "((BTMEM - LOMEM) - Idle) - PRMEM"
Free = number of bytes left in heap. This is the same as the number of bytes
of heap which have never been allocated. This is simply the FRMEM variable.
>+mem
> Total Reserve Never Perm Temp Prev
> Alloc Alloc Alloc Alloc
>Heap memory 3390987 0 1952135 1410832 25700 2320
Total = size of heap. This is calculated as (TPMEM - LOMEM).
Reserve = bytes of heap which are not available to the memory allocators
(for various reasons).
Never = same as "Free" (i.e. FRMEM)
Perm = number of bytes allocated by the permanently memory allocator
This is simply the current value of PRMEM.
Temp = same as "Busy"
Prev = same as "Idle"
So if you add Never+Perm+Temp+Prev you should get Total.
Buffer memory is either allocated from heap or separately (depending on the platform) in this
case its allocated from heap. So the total amount of heap is 3390987 bytes or 3.23Mb. The
rest of DRAM is taken up with things like static data and stacks. In this case code executes
from Flash memory.
|
| <<< IROCZ::USER4:[NOTES$LIBRARY]COMMON_BROUTERS.NOTE;1 >>>
-< Digital Brouters Conference >-
================================================================================
Note 928.1 memory sizes reported by 90EI... 1 of 1
MARVIN::HART "Tony Hart, InterNetworking Prod. Eng." 69 lines 6-JUN-1997 05:25
-< Memory variables description >-
--------------------------------------------------------------------------------
There are two types of memory allocation request in the DRS code, one allocates
memory permanently (i.e. that memory will never be free'd) and the other
allocates memory temporarily (i.e. the memory may be free'd sometime in the
future). Both types of allocation come out of the same contiguious heap.
When memory is free'd it isn't returned to the heap instead its put on a list
(several lists actually based on its size), the temporary memory allocator first
attempts to satisfy a request from this list before allocating it from heap.
The following variables are used to keep track of the heap, I need to describe
them here to make the numbers below make sense.
LOMEM - Address of first byte of heap memory
TPMEM - Address of last byte of heap memory
BTMEM - Address of first byte of unallocated heap. This variable
starts out equal to LOMEM and as heap is allocated to grows
towards TPMEM. This variable *never* decrements (since
memory is never returned to heap, free'd memory being kept
on the lookaside lists).
FRMEM - Count of the number of bytes of heap that are free. This
value is decremented each time memory is allocated from the
heap, it never increments.
PRMEM - Count of the number of bytes of heap which have been
allocated by the permanent memory allocator. This value
never decrements.
OK so what do the numbers represent ...
>*mem
>Number of bytes: Busy = 14408, Idle = 2832, Free = 1962915
Idle = number of bytes referenced by the lookaside lists. So this
represents memory that was allocated from the heap by the
temporary memory allocator and has subsequently been returned
to pool and is available for re-allocation as temporary memory.
This is calculated by adding up all the memory blocks in the
lookaside list.
Busy = number of bytes of heap in currently in use.
This is calculated as "((BTMEM - LOMEM) - Idle) - PRMEM"
Free = number of bytes left in heap. This is the same as the number
of bytes of heap which have never been allocated. This is
simply the FRMEM variable.
>+mem
> Total Reserve Never Perm Temp Prev
> Alloc Alloc Alloc Alloc
>Heap memory 3390987 0 1952135 1410832 25700 2320
Total = size of heap. This is calculated as (TPMEM - LOMEM).
Reserve = bytes of heap which are not available to the memory allocators
(for various reasons).
Never = same as "Free" (i.e. FRMEM)
Perm = number of bytes allocated by the permanently memory allocator
This is simply the current value of PRMEM.
Temp = same as "Busy"
Prev = same as "Idle"
So if you add Never+Perm+Temp+Prev you should get Total.
Buffer memory is either allocated from heap or separately (depending on the
platform) in this case its allocated from heap. So the total amount of heap is
3390987 bytes or 3.23Mb. The rest of DRAM is taken up with things like static
data and stacks. In this case code executes from Flash memory.
|