Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

Memory Management Utilities

Memory management utilites for the daemon. More...


Files

file  Memory.c
 Memory management code.

file  Memory.h
 Memory management declarations.


Data Structures

struct  ANetMemoryTag
 Opaque memory tag. More...


Typedefs

typedef UInt32 ANetMemoryTag

Functions

UInt32 IsTagValid (ANetMemoryTag tag)
 Checks if an ANetMemoryTag is valid. More...

ANetMemoryTag NewMemoryBlock (UInt32 size, UInt32 flags)
 Creates a new memory block. More...

UInt32 DeleteMemoryBlock (ANetMemoryTag tag)
 Deletes a memory block. More...

UInt32 GetMemoryBlockSize (ANetMemoryTag tag)
 Gets the size of a memory block. More...

UInt32 ResolveMemoryTag (ANetMemoryTag tag, UInt8 **ptr)
 Resolves an ANetMemoryTag. More...


Detailed Description

Memory management utilites for the daemon.

Those functions are used to create, change, delete and manage memory blocks allocated in the daemon's memory partition.

Their implementation is totoally cross-platform yet are much more flexible than what is offered by the functions offered in the ANSI C libraries.

While use of those functions is not essential, it is highly recommended. Any data stored in a memory block generated by those functions can be tracked (for leak detection), stored on hard disk and relocated transparently.


Typedef Documentation

typedef UInt32 ANetMemoryTag
 

Definition at line 52 of file Memory.h.

Referenced by ANetCloseFile(), ANetGetGlobals(), ANetGetSetFilePath(), ANetReadFile(), DeleteMemoryBlock(), GetMemoryBlockSize(), IsTagValid(), MemoryTest(), NewMemoryBlock(), and ResolveMemoryTag().


Function Documentation

UInt32 DeleteMemoryBlock ANetMemoryTag    tag
 

Deletes a memory block.

Parameters:
tag  ANetMemoryTag to the block to delete.
Returns:
  • 0: No error.
  • 1: Tag is invalid.
This deletes a memory block generated by a previous call to NewMemoryBlock().
See also:
NewMemoryBlock()

Definition at line 83 of file Memory.c.

References ANetMemoryTag.

UInt32 GetMemoryBlockSize ANetMemoryTag    tag
 

Gets the size of a memory block.

Parameters:
tag  ANetMemoryTag to the memory block.
Returns:
The size, in bytes, of the memory block.
This function returns the size of a memory block.

The returned value is unexpected if tag is not valid, but the function should not produce any other error.

See also:
IsTagValid()

Definition at line 102 of file Memory.c.

References ANetMemoryTag.

UInt32 IsTagValid ANetMemoryTag    tag
 

Checks if an ANetMemoryTag is valid.

Parameters:
tag  The tag to check.
Returns:
Any non-zero value if the tag is valid. 0 otherwise.
This function checks for the validity of an ANetMemoryTag.

Definition at line 39 of file Memory.c.

References ANetMemoryTag.

ANetMemoryTag NewMemoryBlock UInt32    size,
UInt32    flags
 

Creates a new memory block.

Parameters:
size  The size, in bytes, of the memory block to create.
flags  Flags for the new memory block. Currently ignored; use 0.
Returns:
A memory tag that represents the new memory block.
This function creates a new memory block. It returns a new ANetMemoryTag which can be used with other functions.

Use IsTagValid() to make sure the tag was generated properly and no error occured.

See also:
IsTagValid()

Definition at line 59 of file Memory.c.

References ANetMemoryTag.

UInt32 ResolveMemoryTag ANetMemoryTag    tag,
UInt8 **    ptr
 

Resolves an ANetMemoryTag.

Parameters:
tag  The ANetMemoryTag.
ptr  The address of the pointer to set.
Returns:
  • 0: No error.
  • 1: Invalid tag value.
  • 2: Invalid ptr value.
This function returns a pointer to the beginning of a memory block pointed by an ANetMemoryTag.
Warning:
The pointer returned is valid only within the scope of the function that called ResolveMemoryTag. That pointer might become invalid as soon as your function returns.

Definition at line 123 of file Memory.c.

References ANetMemoryTag.


Generated on Sun Dec 23 15:21:00 2001 for ANet by doxygen 1.2.12 written by Dimitri van Heesch, © 1997-2001

SourceForge
Logo