NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Namespaces | Functions
memory.hpp File Reference

The workspaces NumericAL keeps between calls, given back (numerical::release_memory). More...

#include <chrono>
#include "buffer.hpp"
#include "parallel.hpp"
Include dependency graph for memory.hpp:

Go to the source code of this file.

Namespaces

namespace  numerical
 The NumericAL public API.
 
namespace  numerical::detail
 

Functions

void numerical::detail::release_and_trim ()
 release_thread_memory, then the allocator's free pages to the system, on the calling thread: glibc keeps an arena for each thread that allocates, whose free pages the thread trims best itself.
 
void numerical::detail::release_memory_on (thread_pool *pool)
 numerical::release_memory with pool's workers, none where it is nullptr (a pool never started holds nothing, and starting it would cost threads, not free memory).
 
void numerical::release_memory ()
 Frees the workspaces NumericAL keeps between calls, as oneMKL's mkl_free_buffers: each thread keeps the buffers its kernels last needed (a matrix product's packing, a solve's copies, an eigh's merges, an FFT's scratch), so the next call of a size faults no fresh page in (a solve of order 1000 spent 2.5 ms of its 30 on them), and freed blocks of a few megabytes are kept for the next buffer that fits one. A long-lived process (a server, a notebook) that is done with large problems can give that memory back.
 

Detailed Description

The workspaces NumericAL keeps between calls, given back (numerical::release_memory).

Definition in file memory.hpp.