summaryrefslogtreecommitdiff
path: root/Runtime/Allocator/LinearAllocator.cpp
blob: 9d0b23bf323c4f96f44691cfeb8c640a46b2c905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "UnityPrefix.h"
#include "Configuration/UnityConfigure.h"
#include "LinearAllocator.h"


#if 0

struct FwdAllocatorMarker {
	FwdAllocatorMarker (ForwardLinearAllocator& al) : al_(al), p_(al.current ()) {}
	~FwdAllocatorMarker () { al_.rewind (p_); }

	void*					p_;
	ForwardLinearAllocator&	al_;
};


void TestLinearAllocator ()
{
	ForwardLinearAllocator la (32);

	void* p0 = la.allocate (16);
	void* p1 = la.allocate (16);

	{
		FwdAllocatorMarker m (la);
		void* p2 = la.allocate (32);
	}

	void* c1 = la.current ();
	{
		FwdAllocatorMarker m (la);
		void* p3 = la.allocate (8);
		void* p4 = la.allocate (32);
		void* p5 = la.allocate (32);
	}
	la.rewind (c1);
}
#endif