Starboard Module Reference: memory.h
Stay organized with collections
Save and categorize content based on your preferences.
Defines functions for memory allocation, alignment, copying, and comparing.
Porters
All of the "Unchecked" and "Free" functions must be implemented, but they should
not be called directly. The Starboard platform wraps them with extra accounting
under certain circumstances.
Porters and Application Developers
Nobody should call the "Checked", "Unchecked" or "Free" functions directly
because that evades Starboard's memory tracking. In both port implementations
and Starboard client application code, you should always call SbMemoryAllocate
and SbMemoryDeallocate rather than SbMemoryAllocateUnchecked and SbMemoryFree.
The "checked" functions are SbMemoryAllocateChecked(),
SbMemoryReallocateChecked(), and SbMemoryAllocateAlignedChecked().
The "unchecked" functions are SbMemoryAllocateUnchecked(),
SbMemoryReallocateUnchecked(), and SbMemoryAllocateAlignedUnchecked().
The "free" functions are SbMemoryFree() and SbMemoryFreeAligned().
Enums
SbMemoryMapFlags
The bitwise OR of these flags should be passed to SbMemoryMap to indicate how
the mapped memory can be used.
Values
kSbMemoryMapProtectReserved
No flags set: Reserves virtual address space. SbMemoryProtect() can later
make it accessible.
kSbMemoryMapProtectRead
kSbMemoryMapProtectWrite
kSbMemoryMapProtectExec
kSbMemoryMapProtectReadWrite
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-29 UTC."],[[["Defines functions for memory allocation, alignment, copying, and comparing within the Starboard platform."],["\"Unchecked\" and \"Free\" functions are to be implemented but not directly called, as Starboard handles them through wrappers for tracking purposes."],["Directly calling \"Checked,\" \"Unchecked,\" or \"Free\" functions is discouraged to maintain Starboard's memory tracking, instead using `SbMemoryAllocate` and `SbMemoryDeallocate`."],["`SbMemoryMapFlags` enums, like `kSbMemoryMapProtectReserved`, `kSbMemoryMapProtectRead`, `kSbMemoryMapProtectWrite`, and `kSbMemoryMapProtectExec` determine how memory can be used after mapping."]]],["The content outlines functions for managing memory, including allocation, reallocation, alignment, and deallocation. \"Checked,\" \"Unchecked,\" and \"Free\" functions exist, but only `SbMemoryAllocate` and `SbMemoryDeallocate` should be directly called to ensure proper memory tracking. The \"Unchecked\" and \"Free\" functions must be implemented by porters, but are wrapped by the Starboard platform. `SbMemoryMapFlags` enums control memory usage permissions with values for reserving, reading, writing, and executing.\n"]]