Repository navigation
0.2.0: fix heap corruption, configurable alignment, Unity tests, GitHub Actions - #5
Merged
Merged
Conversation
Allocating into a hole cut the assigned chain short, a split remainder smaller than a header wrapped freemem, chain inserts left stale links, realloc could grow past the end of a region or over the next block's header, addblock miscounted totalmem across regions, and calloc and the alignment rounding could overflow. Alignment is now PMALLOC_ALIGN, defaulting to the pointer size, with headers padded to it. pmalloc_sizeof reports the requested size again. No declaration or type changes. Adds PMALLOC_VERSION 0.2.0.
The tests are rewritten in C against a vendored Unity 2.7.0, so the project is C only and nothing is downloaded. 55 tests cover every line and branch of pmalloc.c, with a heap invariant checker and seeded stress runs. CMake reads the version from pmalloc.h, scopes warnings to pmalloc's own targets, adds PMALLOC_* options, and installs a pmalloc::pmalloc package. Tests and examples build only at top level.
CI builds and tests on Linux GCC and Clang, 32-bit, several alignments and macOS, cross-compiles for Cortex-M0 and M4, and requires 100% line and branch coverage before uploading to Codecov.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
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 function, type or declaration changes: code written against the current release compiles and links unchanged, and the old examples build and run against this branch.
Fixes
freememto about 4 GiB.pmalloc_addblockadded the running free total tototalmem, so it was wrong after a second region; it also accepted NULL and unusably small regions.pmalloc_callocdid not checknum * sizefor overflow, and sizes near 4 GiB wrapped when aligned.Changes
PMALLOC_ALIGN(compile-time or CMake option), defaulting to the pointer size as before. Headers are padded to it, and invalid values fail to compile.pmalloc_sizeofreports the requested size again instead of the rounded size. A block that kept a remainder too small to become a free block reports its whole usable size.PMALLOC_ALIGNbytes apart, so they are never merged and the accounting holds.PMALLOC_VERSIONmacros (0.2.0),extern "C"guards, and a CMakepmalloc::pmallocpackage with install rules.Tests and CI
pmalloc.c. They pass on macOS and Linux, GCC and Clang, 32-bit and 64-bit, alignments 8 to 64, and under ASan and UBSan.Docs
The README is now a getting-started guide with badges. The API reference moves to
docs/API.md, andCHANGELOG.mdrecords this release.