Comments (3)
I added a new test target on the latest dev branch so do more API surface checks. The strategy is outlined in the new test/readme.md
:
Testing allocators is difficult as bugs may only surface after particular
allocation patterns. The main approach to testing mimalloc is therefore
to have extensive internal invariant checking (see page_is_valid
in page.c
for example), which is enabled in debug mode with -DMI_CHECK_FULL=ON
.
The main testing strategy is then to run mimalloc-bench
using full
invariant checking to catch any potential problems over a wide range of intensive
allocation benchmarks and programs.
However, this does not test well for the entire API surface and this is tested
with test-api.c
when using make test
(from out/debug
etc). (This is
not complete yet, please add to it.)
The main.c
and main-override.c
are there to test if building and overriding
from a local install works and therefore these build a separate test/CMakeLists.txt
.
from mimalloc.
Yes, it would be nice to have a structured test framework for the full API. However, testing allocators is very hard as only specific allocation patterns may lead to bugs. The way we chose to tackle this in mimalloc is to have extensive invariant checking in the code, for example:
https://github.com/microsoft/mimalloc/blob/master/src/page.c#L72
where all invariants on a page are checked. When building in debug mode, with the cmake option
-DCHECK_FULL=ON
all these invariant checks are done on every free and allocation. We then run the
mimalloc-bench test (and SpecMark and other programs) on this to extensively check if the heap state is always valid.
I would like to add regular unit tests though for the functional testing of the whole API surface.
from mimalloc.
@daanx Regarding tests, is it normal I get (this is mimalloc-test, x64, sdk 18362):
heap stats: peak total freed unit count
elapsed: 0.000 s
process: user: 0.000 s, system: 0.016 s, faults: 644, reclaims: 0, rss: 2.2 mb
from mimalloc.
Related Issues (20)
- VS 2019/VS2022: compiler warning: warning C4559: 'operator new': redefinition; the function gains __declspec(restrict)
- Any solution for static override on Windows?
- Build error on Haiku
- Crash on Android
- [BUG] `free(): invalid pointer` (moved from `vscode-dotnettools` repo) HOT 1
- error: 'mi_posix_memalign' is missing exception specification 'noexcept' HOT 1
- AddressSanitizer: attempting free on address which was not malloc()-ed
- System requirements for mimalloc
- Malloc the pinned memory for a 10GB picture
- Fails to build on mipsel / m68k / powerpc / sh4 HOT 1
- mi_malloc is much slower then original malloc in Windows (In big memory allocation, bigger then 1MB) HOT 7
- is this project died?
- CMake find_package: mimalloc-config.cmake points to a mimalloc.cmake file that does not exist HOT 2
- error: 'large_os_page_size' undeclared HOT 2
- Using bitmaps instead of linked lists to manage free memory blocks
- [question] Is shared memory supported ?
- msvc build application(support windows xp)
- crash on Intel CPUs with FSRM HOT 5
- Single file amalgamation
- Linux: Crash can occur if mimalloc is unloaded before thread ends
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mimalloc.