• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
        • Memoize
        • Fast-alists
        • Hons
        • Set-max-mem
          • Hons-enabled
          • Unmemoize
          • Number-subtrees
        • Events
        • History
        • Parallelism
        • Programming
        • Start-here
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Hons-and-memoization

    Set-max-mem

    An enhanced memory management scheme. (CCL only; requires a trust tag)

    Typical usage:

    (include-book "centaur/misc/memory-mgmt" :dir :system) ;; adds ttag
    (value-triple (set-max-mem (* 4 (expt 2 30))))           ;; 4 GB

    Logically (set-max-mem n) just returns nil.

    Under the hood, loading the centaur/misc/memory-mgmt book adds some special garbage collection hooks into CCL, and set-max-mem influences the behavior of these hooks.

    Roughly speaking, (set-max-mem n) means: try to use no more than n bytes of heap memory. You should think of this as a soft cap. Generally the limit will grow by increments of 1 GB as you start to run out of memory.

    Note that this only influences the heap memory. To avoid swapping death, you should typically pick an n that leaves space for the stacks and other processes on your system. For instance, if your machine has only 8 GB of physical memory, you may wish to reserve no more than about 6 GB for the heap.

    Interaction with build::cert.pl

    The build::cert.pl build system scans for calls of set-max-mem and uses them to infer how much memory a book will need. This information may be useful for scheduling jobs when carrying out distributed builds on a cluster.

    Note that this parsing is done by a simple Perl script, so you can't just use an arbitrary Lisp expression here. Explicitly supported expressions are:

    • (* n (expt 2 30))
    • (expt 2 n)

    Using set-max-mem in Pure ACL2 Books

    To make it possible to embed calls of set-max-mem into ordinary, trust-tag free ACL2 code, the logical definition of set-max-mem is found in the book:

    (include-book "centaur/misc/memory-mgmt-logic" :dir :system)

    Note that if you load only this -logic book, without also loading the raw book, then set-max-mem will do nothing except print a message saying it is doing nothing.