Go to the source code of this file.
Compounds | |
class | lock |
union | obj |
class | vnl_alloc |
Variables | |
const int | VNL_ALLOC_ALIGN = 8 |
const vcl_size_t | VNL_ALLOC_MAX_BYTES = 256 |
const vcl_size_t | VNL_ALLOC_NFREELISTS = VNL_ALLOC_MAX_BYTES/VNL_ALLOC_ALIGN |
Important implementation properties: 1. If the client request an object of size > __MAX_BYTES, the resulting object will be obtained directly from malloc. 2. In all other cases, we allocate an object of size exactly ROUND_UP(requested_size). Thus the client has enough size information that we can return the object to the proper free li*st without permanently losing part of the object.
The first template parameter specifies whether more than one thread may use this allocator. It is safe to allocate an object from one instance of a default_alloc and deallocate it with another one. This effectively transfers its ownership to the second one. This may have undesirable effects on reference locality. The second parameter is unreferenced and serves only to allow the creation of multiple default_alloc instances. Node that containers built on different allocator instances have different types, limiting the utility of this approach.
Definition in file vnl_alloc.h.
|
Definition at line 38 of file vnl_alloc.h. |
|
Definition at line 39 of file vnl_alloc.h. Referenced by vnl_alloc::allocate(), and vnl_alloc::deallocate(). |
|
Definition at line 40 of file vnl_alloc.h. |