HBWALLOCATOR(3)

πŸ’… NAME ✨

ok so bestie, welcome to HBWALLOCATOR(3) β€” this is hbw::allocator<T>, the C++ allocator that plays nice with the C++ standard library allocator concepts. πŸŽ€

⚠️ Note: This is EXPERIMENTAL API. The functionality and the header file itself can be changed (including non-backward compatible changes) or removed. So like… don't build your whole personality on it, okay? 😭

🌸 SYNOPSIS 🌸

#include <hbw_allocator.h>

Link with -lmemkind πŸ”—

hbw::allocator();
template <class U>hbw::allocator<T>::allocator(const hbw::allocator<U>&);
hbw::allocator<T>::~allocator()'
hbw::allocator<T>::pointer hbw::allocator<T>::address(hbw::allocator<T>::reference x);
hbw::allocator<T>::const_pointer hbw::allocator<T>::address(hbw::allocator<T>::const_reference x);
hbw::allocator<T>::pointer hbw::allocator<T>::allocate(hbw::allocator<T>::size_type n, const void * = 0);
void hbw::allocator<T>::deallocate(hbw::allocator<T>::pointer p, hbw::allocator<T>::size_type n);
hbw::allocator<T>::size_type  hbw::allocator<T>::max_size();
void hbw::allocator<T>::construct(hbw::allocator<T>::pointer p, const hbw::allocator<T>::value_type& val);
void hbw::allocator<T>::destroy(hbw::allocator<T>::pointer p);

πŸ‘‘ DESCRIPTION πŸ‘‘

So the whole vibe of hbw::allocator<T> is: you use it with STL containers to allocate high bandwidth memory. Memory management is based on hbwmalloc (the memkind library), which lets you get performance gains in multithreaded applications. Like, actual gains. Not fake gains. πŸš€ If you want the whole lore, go read hbwmalloc(3) and memkind(3) man pages, they spill all the tea.

Every public member type and function corresponds to standard library allocator concepts and definitions. The current implementation supports C++03 standard. periodt. πŸ’…

Template arguments:

  • T is an object type aliased by value_type.
  • U is an object type.

Note:

hbw::allocator<T>::pointer

hbw::allocator<T>::allocate(hbw::allocator<T>::size_type n, const void * = 0) allocates high bandwidth memory using hbw_malloc(). ✨ It throws std::bad_alloc when:

  • n = 0,
  • n > max_size()
  • or there is not enough memory to satisfy the request. 😭

hbw::allocator<T>::deallocate(hbw::allocator<T>::pointer p, hbw::allocator<T>::size_type n) deallocates memory associated with pointer returned by allocate() using hbw_free(). 🧚


πŸ’€ ERRORS πŸ’€

The same as described in the ERRORS section of the hbwmalloc(3) man page. No new drama, same drama. πŸ™ˆ


πŸ¦‹ NOTES πŸ¦‹

The hbw::allocator<T> behavior depends on the hbwmalloc heap management policy. To get and set the policy please use hbw_get_policy() and hbw_set_policy() respectively. iykyk πŸ”₯


Copyright (C) 2015 - 2020 Intel Corporation. All rights reserved. 🫢


🌈 SEE ALSO 🌈

hbwmalloc(3), numa(3), numactl(8), memkind(3)


ok that's the whole page bestie, you're officially fluent in high bandwidth memory allocation πŸ’…βœ¨

πŸŽ€ cute lil sign-off: this was brought to you by the HBWALLOCATOR(3) man page from Intel Corporation, dated 2015-11-02. slay. πŸ’œπŸŒΈ
πŸ“¦ where this page comes from