Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

IEnv interface

The IEnv interface provides a basic set of services a component requires for instantiation and initialization, including memory allocation. IEnv provides methods to allocate, resize, and free heap nodes. It also provides heap information without the need to search for it. These IEnv functions are optimal for writing services or device drivers in the Brew MP component model. IEnv provides the following features:

  • By default, allocated memory is zero-initialized (ZI). A NoZI function is provided for places where the need for performance outweighs this convenience.
  • Name functions accept a debug name, which is stored along with the memory block.
  • A non-zero error code is returned on allocation failure. The pointer should be ignored.
  • A node of size zero is interpreted not as an allocation request, but as a request to free the block.
  • Err is used in the names of function that return an error code rather than a pointer.

IEnv functions allow OS Services extensions and device drivers to access the heap with the same functionality as the application-layer interfaces. However, IEnv functions with "Err" in the function name conform to the Brew MP component model, which means they always return an integer error code instead of a pointer; these functions are not interchangeable with the application-layer functions(MALLOC(), REALLOC(), and FREE()) that return a pointer.

See the C/C++ API Reference and AEEIEnv.h for other IEnv methods including IEnv_ErrMallocName(), IEnv_ErrMallocNameNoZI(), and IEnv_ErrMallocNoZI().

Required Files
AEEIEnv.h

AEECEnv.h

Class ID(s)
AEECLSID_Env
Interface ID
AEEIID_IEnv
Location
\platform\system\inc

IEnv_ErrMalloc()

This function allocates a block of heap memory. It can store a debug string with the filename and line number of the ErrMalloc ; IEnv_ErrMallocName() and DUMPHEAP() can also return the debug name.

IEnv_ErrRealloc()

This function allocates a block of heap memory. It can store a debug string with the filename and line number of the ErrMalloc; IEnv_ErrReallocName() and DUMPHEAP() can also return the debug name.

IEnv_Free()

This function frees a block of heap memory.