[bootlin/training-materials updates] master: labs: debugging: rename heap_allocator.c to heap_profile.c (78c9b5ae)
Clément Léger
clement.leger at bootlin.com
Thu Jan 5 11:10:09 CET 2023
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/78c9b5ae344a61673d52999d07369afbe8688cfc
>---------------------------------------------------------------
commit 78c9b5ae344a61673d52999d07369afbe8688cfc
Author: Clément Léger <clement.leger at bootlin.com>
Date: Thu Jan 5 10:49:32 2023 +0100
labs: debugging: rename heap_allocator.c to heap_profile.c
Signed-off-by: Clément Léger <clement.leger at bootlin.com>
>---------------------------------------------------------------
78c9b5ae344a61673d52999d07369afbe8688cfc
.../nfsroot/root/heap_profile/heap_allocator.c | 64 ----------------------
.../nfsroot/root/heap_profile/heap_profile.c | 64 ++++++++++++++++++++++
2 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/lab-data/debugging/nfsroot/root/heap_profile/heap_allocator.c b/lab-data/debugging/nfsroot/root/heap_profile/heap_allocator.c
deleted file mode 100644
index 722979fc..00000000
--- a/lab-data/debugging/nfsroot/root/heap_profile/heap_allocator.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define ALLOC_COUNT 10
-
-static void *small_array[ALLOC_COUNT];
-
-static void allocate_small(void)
-{
- int i;
-
- for (i = 0; i < ALLOC_COUNT; i++) {
- small_array[i] = malloc(10000);
- usleep(100);
- }
-}
-
-static void free_small(void)
-{
- int i;
-
- for (i = 0; i < ALLOC_COUNT; i++)
- free(small_array[i]);
-}
-
-static void allocate_temporary(void)
-{
- int i;
- void *array[ALLOC_COUNT];
-
- for (i = 0; i < ALLOC_COUNT; i++) {
- array[i] = malloc(10000);
- memset(array[i], 0x0, 10000);
- free(array[i]);
- usleep(100);
- }
-}
-
-static void allocate_large()
-{
- int i;
- void *array[ALLOC_COUNT];
-
- for (i = 0; i < ALLOC_COUNT; i++) {
- array[i] = malloc(i * 10000);
- usleep(100);
- }
-}
-
-static void allocate(void)
-{
- allocate_large();
- allocate_small();
- allocate_temporary();
- free_small();
-}
-
-int main(int argc, char **argv)
-{
- allocate();
-
- return 0;
-}
\ No newline at end of file
diff --git a/lab-data/debugging/nfsroot/root/heap_profile/heap_profile.c b/lab-data/debugging/nfsroot/root/heap_profile/heap_profile.c
new file mode 100644
index 00000000..722979fc
--- /dev/null
+++ b/lab-data/debugging/nfsroot/root/heap_profile/heap_profile.c
@@ -0,0 +1,64 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ALLOC_COUNT 10
+
+static void *small_array[ALLOC_COUNT];
+
+static void allocate_small(void)
+{
+ int i;
+
+ for (i = 0; i < ALLOC_COUNT; i++) {
+ small_array[i] = malloc(10000);
+ usleep(100);
+ }
+}
+
+static void free_small(void)
+{
+ int i;
+
+ for (i = 0; i < ALLOC_COUNT; i++)
+ free(small_array[i]);
+}
+
+static void allocate_temporary(void)
+{
+ int i;
+ void *array[ALLOC_COUNT];
+
+ for (i = 0; i < ALLOC_COUNT; i++) {
+ array[i] = malloc(10000);
+ memset(array[i], 0x0, 10000);
+ free(array[i]);
+ usleep(100);
+ }
+}
+
+static void allocate_large()
+{
+ int i;
+ void *array[ALLOC_COUNT];
+
+ for (i = 0; i < ALLOC_COUNT; i++) {
+ array[i] = malloc(i * 10000);
+ usleep(100);
+ }
+}
+
+static void allocate(void)
+{
+ allocate_large();
+ allocate_small();
+ allocate_temporary();
+ free_small();
+}
+
+int main(int argc, char **argv)
+{
+ allocate();
+
+ return 0;
+}
\ No newline at end of file
More information about the training-materials-updates
mailing list