BRL-CAD
memalloc.c File Reference
#include "common.h"
#include "bio.h"
#include "vmath.h"
#include "raytrace.h"
Include dependency graph for memalloc.c:

Go to the source code of this file.

Macros

#define M_TMTCH   00001 /* Top match */
 
#define M_BMTCH   00002 /* Bottom match */
 
#define M_TOVFL   00004 /* Top overflow */
 
#define M_BOVFL   00010 /* Bottom overflow */
 

Functions

size_t rt_memalloc (struct mem_map **pp, register size_t size)
 
struct mem_maprt_memalloc_nosplit (struct mem_map **pp, register size_t size)
 
size_t rt_memget (struct mem_map **pp, register size_t size, off_t place)
 
size_t rt_memget_nosplit (struct mem_map **pp, register size_t size, size_t place)
 
void rt_memfree (struct mem_map **pp, size_t size, off_t addr)
 
void rt_mempurge (struct mem_map **pp)
 
void rt_memprint (struct mem_map **pp)
 
void rt_memclose (void)
 

Detailed Description

Functions - rt_memalloc allocate 'size' of memory from a given map rt_memget allocate 'size' of memory from map at 'place' rt_memfree return 'size' of memory to map at 'place' rt_mempurge free everything on current memory chain rt_memprint print a map rt_memclose

The structure of the displaylist memory map chains consists of non-zero count and base address of that many contiguous units. The addresses are increasing and the list is terminated with the first zero link.

rt_memalloc() and rt_memfree() use these tables to allocate displaylist memory.

For each Memory Map there exists a queue (coremap). There also exists a queue of free buffers which are enqueued on to either of the previous queues. Initially all of the buffers are placed on the `freemap' queue. Whenever a buffer is freed because of coalescing ends in rt_memfree() or zero size in rt_memalloc() the mapping buffer is taken off from the respective queue and returned to the `freemap' queue.

Definition in file memalloc.c.

Macro Definition Documentation

#define M_TMTCH   00001 /* Top match */

Definition at line 63 of file memalloc.c.

Referenced by rt_memfree().

#define M_BMTCH   00002 /* Bottom match */

Definition at line 64 of file memalloc.c.

Referenced by rt_memfree().

#define M_TOVFL   00004 /* Top overflow */

Definition at line 65 of file memalloc.c.

Referenced by rt_memfree().

#define M_BOVFL   00010 /* Bottom overflow */

Definition at line 66 of file memalloc.c.

Referenced by rt_memfree().

Function Documentation

size_t rt_memalloc ( struct mem_map **  pp,
register size_t  size 
)

Definition at line 69 of file memalloc.c.

References mem_map::m_addr, mem_map::m_nxtp, mem_map::m_size, and MAP_NULL.

struct mem_map* rt_memalloc_nosplit ( struct mem_map **  pp,
register size_t  size 
)

Definition at line 104 of file memalloc.c.

References mem_map::m_nxtp, mem_map::m_size, and MAP_NULL.

size_t rt_memget ( struct mem_map **  pp,
register size_t  size,
off_t  place 
)

Definition at line 141 of file memalloc.c.

References bu_bomb(), mem_map::m_addr, mem_map::m_nxtp, mem_map::m_size, and MAP_NULL.

Here is the call graph for this function:

size_t rt_memget_nosplit ( struct mem_map **  pp,
register size_t  size,
size_t  place 
)

Returns: 0 Unable to satisfy request <size> Actual size of free block, may be larger than requested size.

Comments: Caller is responsible for returning unused portion.

Definition at line 192 of file memalloc.c.

References bu_bomb(), mem_map::m_addr, mem_map::m_nxtp, mem_map::m_size, and MAP_NULL.

Here is the call graph for this function: