Add kernel memory functions & other memory-related changes (#590)

New Features

- Added policy-based memory allocation APIs with capability flags and optional alignment: `memory_alloc_with_policy`, `memory_realloc_with_policy`, `memory_calloc_with_policy`, and `memory_free`.
- Switched heap memory reporting to `memory_print_stats`.

Bug Fixes

- Improved allocation robustness with capability fallback behavior.
- Added overflow-safe handling for aligned zero-initialized allocations.
- Tightened const-correctness for generated device-tree device arrays.

Tests

- Added unit tests for default policy, alignment, zero-initialization, realloc preservation, freeing, and memory stats reporting.
This commit is contained in:
Ken Van Hoeylandt
2026-07-26 22:59:18 +02:00
committed by GitHub
parent f21c0df6fe
commit 03a6285328
14 changed files with 372 additions and 20 deletions
+8
View File
@@ -37,6 +37,7 @@
#include <tactility/error.h>
#include <tactility/filesystem/file_system.h>
#include <tactility/filesystem/file_mutex.h>
#include <tactility/memory.h>
#include <tactility/module.h>
#include <tactility/wifi_auto_scan.h>
#include <tactility/service/service_instance.h>
@@ -175,6 +176,13 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
DEFINE_MODULE_SYMBOL(file_system_unmount),
DEFINE_MODULE_SYMBOL(file_system_is_mounted),
DEFINE_MODULE_SYMBOL(file_system_get_path),
// memory
DEFINE_MODULE_SYMBOL(MEMORY_POLICY_DEFAULT),
DEFINE_MODULE_SYMBOL(memory_print_stats),
DEFINE_MODULE_SYMBOL(memory_alloc_with_policy),
DEFINE_MODULE_SYMBOL(memory_realloc_with_policy),
DEFINE_MODULE_SYMBOL(memory_calloc_with_policy),
DEFINE_MODULE_SYMBOL(memory_free),
// drivers/gpio_controller
DEFINE_MODULE_SYMBOL(gpio_descriptor_acquire),
DEFINE_MODULE_SYMBOL(gpio_descriptor_release),