Loading...
Searching...
No Matches
MemoryPool Class Reference

Optional memory management using a memory pool such as Umpire (https://github.com/LLNL/Umpire). More...

#include <MemoryPool.H>

Static Public Member Functions

static bool create (bool verbose=false)
 Create a memory pool instance (if not already active).
static void destroy (bool verbose=false)
 Remove the memory pool instance (currently does nothing).
static bool active () noexcept
 True if pool is active (ie, created and not suspended).
static bool suspend () noexcept
 Suspend use of memory pool (for allocation).
static void resume () noexcept
 Resume use of memory pool (if previously active).
static bool is_pool (void *ptr)
 Test if given pointer belongs to the pool.
static void * try_allocate (std::size_t nbytes)
 Allocate from pool (if active).
static bool try_deallocate (void *ptr)
 Deallocate a pointer managed by the pool.

Detailed Description

Optional memory management using a memory pool such as Umpire (https://github.com/LLNL/Umpire).

When compiled with Umpire, its use can be controlled by the FOAM_MEMORY_POOL environment variable, or the memory_pool Optimisation switch (etc/controlDict).

It currently looks for any of the following entries, in this order:

  • true - same as "host"
  • false/none - disabled.
  • "host" - uses host memory pool
  • "system" - same as "host"
  • "device" - uses device memory pool
  • "managed" - uses managed host/device memory pool

The parameters "size=nn" and "incr=nn" (in MegaBytes) can be used to specify alternatives to the default sizing.

Definition at line 58 of file MemoryPool.H.

Member Function Documentation

◆ create()

bool create ( bool verbose = false)
static

Create a memory pool instance (if not already active).

Uses environment or etc/controlDict entry

Referenced by argList::parse().

Here is the caller graph for this function:

◆ destroy()

void destroy ( bool verbose = false)
static

Remove the memory pool instance (currently does nothing).

◆ active()

bool active ( )
staticnoexcept

True if pool is active (ie, created and not suspended).

References Foam::noexcept.

◆ suspend()

bool suspend ( )
staticnoexcept

Suspend use of memory pool (for allocation).

Returns
previous suspend status

References Foam::noexcept, and suspend().

Referenced by suspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resume()

void resume ( )
staticnoexcept

Resume use of memory pool (if previously active).

References Foam::noexcept, and resume().

Referenced by resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_pool()

bool is_pool ( void * ptr)
static

Test if given pointer belongs to the pool.

References is_pool().

Referenced by is_pool().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_allocate()

void * try_allocate ( std::size_t nbytes)
static

Allocate from pool (if active).

Returns
nullptr if the pool is not active

References try_allocate().

Referenced by Foam::ListPolicy::allocate(), and try_allocate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_deallocate()

bool try_deallocate ( void * ptr)
static

Deallocate a pointer managed by the pool.

Returns
True if a nullptr (no-op) or when the pointer was managed by the pool.

References try_deallocate().

Referenced by Foam::ListPolicy::deallocate(), Foam::ListPolicy::deallocate(), and try_deallocate().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: