summaryrefslogtreecommitdiff
path: root/HeapLAB/.src
diff options
context:
space:
mode:
Diffstat (limited to 'HeapLAB/.src')
-rw-r--r--HeapLAB/.src/demo_fastbins.c19
-rw-r--r--HeapLAB/.src/demo_top_chunk.c14
-rw-r--r--HeapLAB/.src/demo_unsortedbin.c16
3 files changed, 49 insertions, 0 deletions
diff --git a/HeapLAB/.src/demo_fastbins.c b/HeapLAB/.src/demo_fastbins.c
new file mode 100644
index 0000000..a50aa1f
--- /dev/null
+++ b/HeapLAB/.src/demo_fastbins.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char* argv[]) {
+
+ void* a = malloc(1);
+ void* b = malloc(1);
+ void* c = malloc(1);
+
+ free(a);
+ free(b);
+ free(c);
+
+ void* d = malloc(1);
+ void* e = malloc(1);
+ void* f = malloc(1);
+
+ return 0;
+}
diff --git a/HeapLAB/.src/demo_top_chunk.c b/HeapLAB/.src/demo_top_chunk.c
new file mode 100644
index 0000000..d8e9767
--- /dev/null
+++ b/HeapLAB/.src/demo_top_chunk.c
@@ -0,0 +1,14 @@
+#include <stdlib.h>
+
+int main(int argc, char* argv[]) {
+
+ void* a = malloc(9);
+
+ malloc(1);
+ malloc(0);
+
+ malloc(24);
+ malloc(25);
+
+ return 0;
+}
diff --git a/HeapLAB/.src/demo_unsortedbin.c b/HeapLAB/.src/demo_unsortedbin.c
new file mode 100644
index 0000000..1bfcc9e
--- /dev/null
+++ b/HeapLAB/.src/demo_unsortedbin.c
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+
+int main(int argc, char* argv[]) {
+ void* a = malloc(0x88);
+ void* b = malloc(0x88);
+
+ free(b);
+
+ b = malloc(0x88);
+ malloc(0x18);
+
+ free(a);
+ free(b);
+
+ return 0;
+}