aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp
blob: 07ad4e2069d85499d0f514c79675b5ce39473823 (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
// =================================================================================================================================
// This sample demonstrates how to use the auto-hooking functionality of HeapInspector. On PlayStation 3, this uses link-time
// malloc/realloc/free overloading. On PC it uses the mhook API, which will hook into the very low-level HeapAlloc, HeapRealloc
// and HeapFree functions. This will cause any allocations in your application to be caught. 
//
// NOTE: the platform specific hooking calls can be found in the Main<platform>.cpp.
// =================================================================================================================================

#include <stdlib.h>

void Wait(int a_MilliSeconds);

void RunHeapInspectorServer()
{
	while (1)
	{
		void* mem1;
		void* memB;
		
		mem1 = malloc(16);
		memB = malloc(1024);

		Wait(100);

		free(mem1);
		free(memB);

		Wait(100);
	}
}