aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp')
-rw-r--r--Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp b/Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp
new file mode 100644
index 00000000..07ad4e20
--- /dev/null
+++ b/Minecraft.Client/PS3/PS3Extras/HeapInspector/Samples/Hook/HookSample.cpp
@@ -0,0 +1,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);
+ }
+}