Memory Management
[Build Configuration]

Collaboration diagram for Memory Management:


Detailed Description

These macros are available to alter the memory management functions in the core library.


Defines

#define DWFCORE_ENABLE_MEMORY_BASE
 Indicates the use of the memory operators in the common base class.
#define DWFCORE_USE_DEFAULT_MEMORY_BASE_IMPL
 Indicates the that the global new() and delete() operators will be used by DWFCoreMemory when used in conjunction with DWFCORE_ENABLE_MEMORY_BASE.
#define DWFCORE_ALLOC_MEMORY(primitive_type, bytes)
 Memory block allocator.
#define DWFCORE_FREE_MEMORY(pointer)
 Memory block deallocator.
#define DWFCORE_ALLOC_OBJECT(object_type)
 Object allocator.
#define DWFCORE_FREE_OBJECT(pointer)
 Object deallocator.
#define DWFCORE_ZERO_MEMORY(pointer, bytes)
 Zero fill a memory buffer.
#define DWFCORE_COPY_MEMORY(dest, src, bytes)
 Copy bytes from one memory buffer to another.
#define DWFCORE_COMPARE_MEMORY(a, b, bytes)
 Compare contents of two memory buffers.


Define Documentation

#define DWFCORE_ALLOC_MEMORY primitive_type,
bytes   ) 
 

Memory block allocator.

Must allocate enough memory to hold sizeof(primitive_type) * bytes and return a pointer to the block. This is a paired macro and the memory block must be deleted with the DWFCORE_FREE_MEMORY macro.

                int* pNumbers = DWFCORE_ALLOC_MEMORY( int, 64 );
                DWFCORE_FREE_MEMORY( pNumbers );
Returns:
A pointer to the new memory block.
Examples:
Digest/main.cpp, and Files/Files.cpp.

Definition at line 316 of file preprocessor.txt.

#define DWFCORE_ALLOC_OBJECT object_type   ) 
 

Object allocator.

Must allocate enough memory to hold sizeof(object_type) and return a pointer to the object. This is a paired macro and the object must be deleted with the DWFCORE_FREE_OBJECT macro.

                DWFString* zText = DWFCORE_ALLOC_OBJECT( DWFString );
                DWFCORE_FREE_OBJECT( zText );
Returns:
A pointer to the new object.
Examples:
Digest/main.cpp, Files/Files.cpp, and Strings/Strings.cpp.

Definition at line 343 of file preprocessor.txt.

#define DWFCORE_COMPARE_MEMORY a,
b,
bytes   ) 
 

Compare contents of two memory buffers.

Returns:
< 0 if is less than b, 0 if a is equal to b, > 0 if b is greater than a.

Definition at line 375 of file preprocessor.txt.

#define DWFCORE_ENABLE_MEMORY_BASE
 

Indicates the use of the memory operators in the common base class.

When this macro is defined, the DWFCoreMemory base class interface exposes the standard new() and delete() operators. These may be then subsequently customized or the global operators may be used by additionally defining DWFCORE_USE_DEFAULT_MEMORY_BASE_IMPL.

Customizations might include object allocation reference counting, ensuring heap integrity and/or using a custom heap (Win32 DLLs, for example.)

Definition at line 296 of file preprocessor.txt.

#define DWFCORE_FREE_MEMORY pointer   ) 
 

Memory block deallocator.

This is a paired macro and deletes memory blocks allocated with the DWFCORE_ALLOC_MEMORY macro.

Note:
This macro is required to set pointer to NULL.
                int* pNumbers = DWFCORE_ALLOC_MEMORY( int, 64 );
                DWFCORE_FREE_MEMORY( pNumbers );
Examples:
Digest/main.cpp, Files/Files.cpp, and Strings/Strings.cpp.

Definition at line 329 of file preprocessor.txt.

#define DWFCORE_FREE_OBJECT pointer   ) 
 

Object deallocator.

This is a paired macro and deletes objects allocated with the DWFCORE_ALLOC_OBJECT macro.

Note:
This macro is required to set pointer to NULL.
                DWFString* zText = DWFCORE_ALLOC_OBJECT( DWFString );
                DWFCORE_FREE_OBJECT( zText );
Examples:
Files/Files.cpp, Strings/Strings.cpp, and Threads/Threads.cpp.

Definition at line 356 of file preprocessor.txt.


Generated on Tue Jan 6 22:39:29 2009 for Autodesk DWF Core Library by  doxygen 1.4.5