Virtual memory support
[Portability layer]


Modules

 Memory protection flags
 Memory page size directives
 These defines can be used instead of explicit calls to port_vmem_page_sizes().

Typedefs

typedef port_vmem_t port_vmem_t
 Virtual memory block descriptor.

Functions

apr_status_t port_vmem_reserve (port_vmem_t **block, void **address, size_t amount, unsigned int protectionMode, size_t pageSize, apr_pool_t *pool)
 Reserves a continuous memory region in the virtual address space of the calling process.
apr_status_t port_vmem_commit (void **address, size_t amount, port_vmem_t *block)
 Commits (a part of) the previously reserved memory region.
apr_status_t port_vmem_decommit (void *address, size_t amount, port_vmem_t *block)
 Decommits the specified region of committed memory.
apr_status_t port_vmem_release (port_vmem_t *block)
 Releases previously reserved virtual memory region as a whole.
size_t * port_vmem_page_sizes ()
 Returns a zero-terminated array of supported memory page sizes.
size_t port_vmem_used_size ()
 Returns the amount of currently used memory in bytes or 0 if this value could not be calculated.
size_t port_vmem_committed_size ()
 Returns the amount of committed memory in bytes or 0 if this value could not be calculated.
size_t port_vmem_reserved_size ()
 Returns the amount of reserved memory in bytes or 0 if this value could not be calculated.
size_t port_vmem_max_size ()
 Returns the maximum amount of memory which could be reserved in bytes or 0 if this value could not be calculated.
apr_status_t port_vmem_allocate (void **addr, size_t size, unsigned int mode)
 Allocate memory with default page size.
apr_status_t port_vmem_free (void *addr, size_t size)
 Releases previously reserved virtual memory region as a whole.


Typedef Documentation

typedef struct port_vmem_t port_vmem_t

Virtual memory block descriptor.

This is an incomplete type, the run-time instance should be obtained via port_vmem_reserve() call


Function Documentation

apr_status_t port_vmem_reserve ( port_vmem_t **  block,
void **  address,
size_t  amount,
unsigned int  protectionMode,
size_t  pageSize,
apr_pool_t *  pool 
)

Reserves a continuous memory region in the virtual address space of the calling process.

Parameters:
[out] block - descriptor for the reserved memory, required for further operations with the memory
[in,out] address - desired starting address of the region to allocate. If NULL, the system determines the appropriate location.On success, the actual allocated address is returned
amount - the size of the region in bytes. For large pages, the size must be multiply of page size
protectionMode - the bit mask of PORT_VMEM_MODE_* flags
pageSize - the desired size of the memory page; should contain PORT_VMEM_PAGESIZE_DEFAULT, PORT_VMEM_PAGESIZE_LARGE or the actual size in bytes
pool - the auxiliary pool to allocate the descriptor data, etc
Returns:
APR_SUCCESS if OK; otherwise, an error code.
See also:
port_vmem_page_sizes()

apr_status_t port_vmem_commit ( void **  address,
size_t  amount,
port_vmem_t block 
)

Commits (a part of) the previously reserved memory region.

The allocated memory is initialized to zero.

Parameters:
[in,out] address - the starting address of the region to commit; the returned value may differ due to page alignment
amount - the size of the region in bytes
block - the descriptor to the reserved virtual memory
Returns:
APR_SUCCESS if OK; otherwise, an error code.

apr_status_t port_vmem_decommit ( void *  address,
size_t  amount,
port_vmem_t block 
)

Decommits the specified region of committed memory.

It is safe to decommit a reserved (but not committed) region.

Parameters:
address - the starting address of the region to decommit
amount - the size of the region in bytes
block - the memory region descriptor
Returns:
APR_SUCCESS if OK; otherwise, an error code.

apr_status_t port_vmem_release ( port_vmem_t block  ) 

Releases previously reserved virtual memory region as a whole.

If the region was committed, the function first decommits it.

Parameters:
block - the memory region descriptor
Returns:
APR_SUCCESS if OK; otherwise, an error code.

size_t* port_vmem_page_sizes (  ) 

Returns a zero-terminated array of supported memory page sizes.

The first element refers to the system default size and is guaranteed to be non-zero. Subsequent elements (if any) provide large page sizes.

size_t port_vmem_used_size (  ) 

Returns the amount of currently used memory in bytes or 0 if this value could not be calculated.

size_t port_vmem_committed_size (  ) 

Returns the amount of committed memory in bytes or 0 if this value could not be calculated.

size_t port_vmem_reserved_size (  ) 

Returns the amount of reserved memory in bytes or 0 if this value could not be calculated.

size_t port_vmem_max_size (  ) 

Returns the maximum amount of memory which could be reserved in bytes or 0 if this value could not be calculated.

apr_status_t port_vmem_allocate ( void **  addr,
size_t  size,
unsigned int  mode 
)

Allocate memory with default page size.

Parameters:
[in,out] addr - desired starting address of the region to allocate. If NULL, the system determines the appropriate location.On success, the actual allocated address is returned
size - the size of the region in bytes. For large pages, the size must be multiply of page size
mode - the bit mask of PORT_VMEM_MODE_* flags

apr_status_t port_vmem_free ( void *  addr,
size_t  size 
)

Releases previously reserved virtual memory region as a whole.

If the region was committed, the function first decommits it.

Parameters:
addr - the memory region address
size - size of the allocated memory
Returns:
APR_SUCCESS if OK; otherwise, an error code.


Genereated on Tue Mar 11 19:25:42 2008 by Doxygen.

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