Skip to content
Snippets Groups Projects
  • Eelco Dolstra's avatar
    0629601d
    Move EvalState from the stack to the heap · 0629601d
    Eelco Dolstra authored
    EvalState contains a few counters (e.g. nrValues) that increase
    quickly enough that they end up being interpreted as pointers by the
    garbage collector. Moving it to the heap makes them invisible to the
    garbage collector.
    
    This reduces the max RSS doing 100 evaluations of
    nixos.tests.firefox.x86_64-linux.drvPath from 455 MiB to 292 MiB.
    
    Note: ideally, allocations would be much further up in the 64-bit
    address space to reduce the odds of an integer being misinterpreted as
    a pointer. Maybe we can use some linker magic to move the .bss segment
    to a higher address.
    0629601d
    History
    Move EvalState from the stack to the heap
    Eelco Dolstra authored
    EvalState contains a few counters (e.g. nrValues) that increase
    quickly enough that they end up being interpreted as pointers by the
    garbage collector. Moving it to the heap makes them invisible to the
    garbage collector.
    
    This reduces the max RSS doing 100 evaluations of
    nixos.tests.firefox.x86_64-linux.drvPath from 455 MiB to 292 MiB.
    
    Note: ideally, allocations would be much further up in the 64-bit
    address space to reduce the odds of an integer being misinterpreted as
    a pointer. Maybe we can use some linker magic to move the .bss segment
    to a higher address.