builds now

This commit is contained in:
MarcUs7i 2025-03-08 16:49:22 +01:00
parent 670c97dd16
commit ed33e08dae
6 changed files with 71 additions and 7 deletions

View file

@ -2,7 +2,7 @@
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Title: Simple Memory Manager. * Title: Simple Memory Manager.
* Author: */<your name>;/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Implementation of a simple memory manager. * Implementation of a simple memory manager.
@ -29,3 +29,67 @@
*/ */
#define MEMORY_BLOCK_CNT 1024; #define MEMORY_BLOCK_CNT 1024;
/**
* Allocates a memory block of the given size in bytes
* in a similar way as `malloc(size)`.
*
* @param size The number of bytes to allocate.
* @return The pointer to the allocated memory block or 0,
* if no memory could be allocated.
*/
void* my_alloc(size_t size) {
return 0;
}
/**
* Releases the addressed memory block that was allocated via function `my_alloc(...)`.
* If the addressed memory is not allocated, a warning is printed.
*
* @param p The pointer to the memory to free.
*/
void my_free(void* p) {
return;
}
/**
* Prints a brief statistic report about memory that reveals the following key values:
* # total available memory in bytes.
* # free (not allocated) memory in bytes.
* # used (allocated) memory in bytes
* # free memory in percentage (0 % to 100%)
* # number of allocated units (continuously allocated portions of the memory, not memory blocks)
* # largest free continuous memory unit in bytes.
*/
MemStat mem_get_statistics() {
return (MemStat){0, 0, 0, 0, 0, 0};
}
/**
* Prints the allocated units (continuously allocated portions of the memory, not memory blocks)
* including their start address within the managed memory as well as their size
* ordered by their start address.
*/
void mem_print_units() {
return;
}
/**
* Provides the index of the allocated unit (continuously allocated portions of the memory, not memory blocks)
* the addressed memory belongs to. If the addressed memory is not allocated or the address is outside
* the range of the managed memory, a value less than zero provided.
*
* @param p_mem The pointer to the memory to query.
* @return The unit index the address belongs to or a value less than 0 if the memory is not allocated.
*/
int get_unit_index(void* p_mem) {
return 0;
}
/**
* Dumps the content of the memory.
*/
void mem_dump() {
return;
}

View file

@ -2,7 +2,7 @@
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Title: Simple Memory Manager. * Title: Simple Memory Manager.
* Author: */<your name>;/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Declaration of functions for memory management. * Declaration of functions for memory management.

View file

@ -2,7 +2,7 @@
* HTBLA-Leonding * HTBLA-Leonding
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
* Title: Simple Memory Manager. * Title: Simple Memory Manager.
* Author: */<your name>;/* * Author: Marc Tismonar
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
* Description: * Description:
* The main application that uses memory manager. * The main application that uses memory manager.
@ -21,5 +21,5 @@
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
/* Your implementation here. */ /* Your implementation here. */
return 0;
} }

View file

@ -2,7 +2,7 @@
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Title: Tests implementation for memory management. * Title: Tests implementation for memory management.
* Author: */<your name>;/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Unit tests for for memory management. * Unit tests for for memory management.

View file

@ -2,7 +2,7 @@
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Title: Unit Tests for Memory Manager implementation * Title: Unit Tests for Memory Manager implementation
* Author: */<your name>;/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Tests functions for memory manager. * Tests functions for memory manager.

View file

@ -2,7 +2,7 @@
* HTBLA-Leonding * HTBLA-Leonding
* --------------------------------------------------------- * ---------------------------------------------------------
* Title: Unit Tests for Memory Manager implementation * Title: Unit Tests for Memory Manager implementation
* Author: */<your name>;/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Tests functions for memory manager. * Tests functions for memory manager.