show alloc mem#6
Merged
Merged
Conversation
Closed
There was a problem hiding this comment.
Pull Request Overview
This PR adds memory visualization functionality by implementing a show_alloc_mem() function, along with supporting utilities for formatted output. The changes also include code cleanup by removing header comment blocks from multiple files.
- Implements
show_alloc_mem()to display memory allocations across tiny, small, and large zones - Adds comprehensive printing utilities for displaying memory ranges, numbers, and hexadecimal addresses
- Cleans up pointer references by setting them to NULL after removal operations
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils.c | New file providing low-level print functions for chars, strings, numbers, and hex formatting |
| include/utils.h | Header file for the new utility print functions |
| src/malloc.c | Implements show_alloc_mem() and adds utils.h import |
| src/zone.c | Adds print_zone() to iterate and print pages in a zone |
| src/page.c | Adds print_page() and find_next_page_in_order() for page printing and traversal |
| src/chunk.c | Adds print_chunk() and find_next_chunk_in_order() for chunk printing and traversal |
| include/zone.h | Declares print_zone() function |
| include/page.h | Declares page printing and ordering functions |
| include/chunk.h | Declares chunk printing and ordering functions |
| include/malloc.h | Adds declarations for free(), realloc(), and show_alloc_mem() |
| test/realloc.c | Adds forward declaration of show_alloc_mem() |
| src/memory/allocate.c | Removes header comment block |
| src/memory/free.c | Removes header comment block |
| src/memory/reallocate.c | Removes header comment block |
| include/allocation.h | Removes header comment block and trailing blank line |
| include/malloc.h | Removes header comment block |
| include/memory.h | Removes header comment block |
| include/test.h | Removes header comment block |
| Makefile | Adds utils.c to the build |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| print_string(" bytes\n"); | ||
| } | ||
|
|
||
| void print_identation(size_t level) { |
There was a problem hiding this comment.
Corrected spelling of 'identation' to 'indentation'.
Suggested change
| void print_identation(size_t level) { | |
| void print_indentation(size_t level) { |
| void print_unumber(size_t number); | ||
| void print_unumber_hexa(size_t number); | ||
| void print_range_address(const void *address, size_t size); | ||
| void print_identation(size_t level); |
There was a problem hiding this comment.
Corrected spelling of 'identation' to 'indentation'.
Suggested change
| void print_identation(size_t level); | |
| void print_indentation(size_t level); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.