Switch mem allocation to custom memory block
No longer repeatedly invoke malloc for retrieving memory. Some operations still leak memory (notably audio streaming). We introduce notion of Transient and Permanent storage. Transient memory is used for data in memory that is temporarily allocated (i.e. graphics for that frame's output), and permanent as more like game state storage. We now give out pointers from a pre-allocated block of memory, so we have no allocation cost and benefits of reduced memory leaks. The transient block gets reset every frame. Any memory allocated within is cleared at no cost simply by rearranging the base pointer of the memory block.
This commit is contained in:
@@ -54,6 +54,9 @@
|
||||
<ClCompile Include="src\String.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\MemoryArena.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="data\shaders\default.vert.glsl" />
|
||||
|
||||
Reference in New Issue
Block a user