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:
2016-09-24 14:43:59 +10:00
parent 85b757aaa7
commit 332888f3b5
24 changed files with 352 additions and 248 deletions
+3
View File
@@ -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" />