HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
virtualMemory.h File Reference
#include "pxr/pxr.h"
#include "pxr/base/arch/api.h"
#include <cstddef>
+ Include dependency graph for virtualMemory.h:

Go to the source code of this file.

Enumerations

enum  ArchMemoryProtection { ArchProtectNoAccess, ArchProtectReadOnly, ArchProtectReadWrite, ArchProtectReadWriteCopy }
 Memory protection options, see ArchSetMemoryProtection(). More...
 

Functions

PXR_NAMESPACE_OPEN_SCOPE
ARCH_API void
ArchReserveVirtualMemory (size_t numBytes)
 
ARCH_API bool ArchCommitVirtualMemoryRange (void *start, size_t numBytes)
 
ARCH_API bool ArchFreeVirtualMemory (void *start, size_t numBytes)
 
ARCH_API bool ArchSetMemoryProtection (void const *start, size_t numBytes, ArchMemoryProtection protection)
 

Detailed Description

Architecture dependent routines for virtual memory.

Definition in file virtualMemory.h.

Enumeration Type Documentation

Memory protection options, see ArchSetMemoryProtection().

Enumerator
ArchProtectNoAccess 
ArchProtectReadOnly 
ArchProtectReadWrite 
ArchProtectReadWriteCopy 

Definition at line 61 of file virtualMemory.h.

Function Documentation

ARCH_API bool ArchCommitVirtualMemoryRange ( void start,
size_t  numBytes 
)

Make the range of numBytes bytes starting at start available for reading and writing. The range must be within one previously reserved by ArchReserveVirtualMemory(). It is not an error to commit a range that was previously partly or fully committed. Return false in case of an error; check errno.

ARCH_API bool ArchFreeVirtualMemory ( void start,
size_t  numBytes 
)

Return memory obtained with ArchReserveVirtualMemory() to the system. The start argument must be the value returned from a previous call to ArchReserveVirtualMemory, and numBytes must match the argument from that call. Memory within the range may not be accessed after this call. Return false in case of an error; check errno.

PXR_NAMESPACE_OPEN_SCOPE ARCH_API void* ArchReserveVirtualMemory ( size_t  numBytes)

Reserve numBytes bytes of virtual memory. Call ArchCommitVirtualMemory() on subranges to write to and read from the memory. Return nullptr in case of an error; check errno.

ARCH_API bool ArchSetMemoryProtection ( void const start,
size_t  numBytes,
ArchMemoryProtection  protection 
)

Change the memory protection on the pages containing start and start + numBytes to protection. Return true if the protection is changed successfully. Return false in case of an error; check errno. This function rounds start to the nearest lower page boundary. On POSIX systems, ArchProtectReadWrite and ArchProtectReadWriteCopy are the same, on Windows they differ but the Windows API documentation does not make it clear what using ReadWrite means for a private file-backed mapping.