Giter Club home page Giter Club logo

Comments (3)

daanx avatar daanx commented on July 19, 2024 1

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.

daanx avatar daanx commented on July 19, 2024

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.

degski avatar degski commented on July 19, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.