This memory allocation manager will obtain blocks of memory from the system and return packets to the server. The blocks will be bigger than required by the server. The server will only request memory from the system as needed and pass out smaller blocks to the server as needed.
The whole point is that a system block is 4K but the only operation that needs memory is a cctalk operation these are queued here in the server. A cctalk operation is 536-bytes so seven of these at a time are requested from the system. This will hopefully reduce memory fragmentation of available free memory to Linux.
NOTE from man page on malloc & free: In case Linux is employed under circumstances where it would be less desirable to suddenly lose some randomly picked processes, and moreover the kernel version is sufficiently recent, one can switch off this over-committing behavior using a command like: # echo 2 > /proc/sys/vm/overcommit_memory
#include <stdlib.h>
#include <string.h>
#include "cctalk-channel-defs.h"
#include "cctalk-operations.h"
#include "cctalk-channel.h"
#include "cctalk-pkts.h"
#include "cctalk-pkt-utls.h"
#include "cctalk-debug.h"
Include dependency graph for cctalk-svr-mem.c:

Data Structures | |
| struct | sCCTM_ALLOCATED_MEMORY |
| union | tuMALLOC_BLOCK |
Typedefs | |
| typedef sCCTM_ALLOCATED_MEMORY | tsCCTM_ALLOCATED_MEMORY |
Enumerations | |
| enum | teCCTALK_MEMORY_CONSTANTS { eNUM_OPERATIONS_IN_BLOCK = 7, eSIZE_OF_MEMORY_CHUNK = 4096 } |
Functions | |
| void | cctm_AllocateMoreMemory (void) |
| Called when run out of cctalk operation structures. | |
| void | cctm_Initialise (void) |
| Initialise the cctalk memory manager. | |
| void | cctm_Shutdown (void) |
| close down the memory manager. | |
| tsCCTALK_OPERATION * | cctm_MallocOp (void) |
| Get a packet from the free list and return it. | |
| void | cctm_FreeOp (tsCCTALK_OPERATION *pCctOp) |
| Free a cctalk operation. | |
Variables | |
| tsCCTALK_OPERATION * | psFreeCctOps |
| tsCCTM_ALLOCATED_MEMORY * | psAllocatedMemory |
| int | zlNumberFreeCctOps |
| int | zlNumAllocatedCctOps |
|
|
|
|
|
Called when run out of cctalk operation structures. This will make a system call to allocation more cctalk operation structures. Structures are allocated on a block basis.
History |
|
|
Free a cctalk operation. Return a cctalk operation to the free list call when finished with a cctalk operation.
History |
|
|
Initialise the cctalk memory manager. Set up the memory manager this is going to be a block manager it is not overly complicated but there are a few complications
History |
Here is the call graph for this function:

|
|
Get a packet from the free list and return it. Called by the server to allocate a cctalk operation that can be used to store an cctalk operation. A cctalk structure is taken from the free list and returned to the calling process.
History |
Here is the call graph for this function:

|
|
close down the memory manager.
History |
1.3.6