modules/portlib/src/main/native/port/windows/hymem.c File Reference


Detailed Description

Memory Utilities.

#include <windows.h>
#include "hyport.h"
#include "portpriv.h"
#include "hyportpg.h"
#include "ut_hyprt.h"

Functions

void *VMCALL hymem_allocate_memory (struct HyPortLibrary *portLibrary, UDATA byteAmount)
 Allocate memory.
void VMCALL hymem_free_memory (struct HyPortLibrary *portLibrary, void *memoryPointer)
 Deallocate memory.
void *VMCALL hymem_reallocate_memory (struct HyPortLibrary *portLibrary, void *memoryPointer, UDATA byteAmount)
 Re-allocate memory.
void VMCALL hymem_shutdown (struct HyPortLibrary *portLibrary)
 PortLibrary shutdown.
I_32 VMCALL hymem_startup (struct HyPortLibrary *portLibrary, UDATA portGlobalSize)
 PortLibrary startup.
void *VMCALL hymem_allocate_memory_callSite (struct HyPortLibrary *portLibrary, UDATA byteAmount, char *callSite)
 Allocate memory.


Function Documentation

void* VMCALL hymem_allocate_memory ( struct HyPortLibrary portLibrary,
UDATA  byteAmount 
)

Allocate memory.

Parameters:
[in] portLibrary The port library
[in] byteAmount Number of bytes to allocate.
Returns:
pointer to memory on success, NULL on error.

Memory is not guaranteed to be zeroed as part of this call

void* VMCALL hymem_allocate_memory_callSite ( struct HyPortLibrary portLibrary,
UDATA  byteAmount,
char *  callSite 
)

Allocate memory.

Parameters:
[in] portLibrary The port library
[in] byteAmount Number of bytes to allocate.
[in] callSite String describing callsite, usually file and line number.
Returns:
pointer to memory on success, NULL on error.

void VMCALL hymem_free_memory ( struct HyPortLibrary portLibrary,
void *  memoryPointer 
)

Deallocate memory.

Parameters:
[in] portLibrary The port library
[in] memoryPointer Base address of memory to be deallocated.

void* VMCALL hymem_reallocate_memory ( struct HyPortLibrary portLibrary,
void *  memoryPointer,
UDATA  byteAmount 
)

Re-allocate memory.

Parameters:
[in] portLibrary The port library
[in] memoryPointer Base address of memory to be re-allocated.
[in] byteAmount Number of bytes to re-allocated.
Returns:
pointer to memory on success, NULL on error.

void VMCALL hymem_shutdown ( struct HyPortLibrary portLibrary  ) 

PortLibrary shutdown.

This function is called during shutdown of the portLibrary. Any resources that were created by hymem_startup should be destroyed here.

Parameters:
[in] portLibrary The port library
Note:
Must deallocate portGlobals.

Most implementations will just deallocate portGlobals.

I_32 VMCALL hymem_startup ( struct HyPortLibrary portLibrary,
UDATA  portGlobalSize 
)

PortLibrary startup.

This function is called during startup of the portLibrary. Any resources that are required for the memory operations may be created here. All resources created here should be destroyed in hymem_shutdown.

Parameters:
[in] portLibrary The port library
[in] portGlobalSize Size of the global data structure to allocate
Returns:
0 on success, negative error code on failure. Error code values returned are
  • HYPORT_ERROR_STARTUP_MEM
Note:
Must allocate portGlobals.

Most implementations will just allocate portGlobals.


Genereated on Tue Dec 9 14:12:59 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.