Classes | Variables
core/vnl/vnl_alloc.h File Reference

Default node allocator. More...

#include <vcl_cstddef.h>

Go to the source code of this file.

Classes

class  vnl_alloc
union  vnl_alloc::obj
class  vnl_alloc::lock

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

Detailed Description

Default node allocator.

Author:
unknown

With a reasonable compiler, this should be roughly as fast as the original STL class-specific allocators, but with less fragmentation. Default_alloc_template parameters are experimental and MAY DISAPPEAR in the future. Clients should just use vcl_alloc for now.

Important implementation properties:

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.

Note that containers built on different allocator instances have different types, limiting the utility of this approach.

Definition in file vnl_alloc.h.


Variable Documentation

const int VNL_ALLOC_ALIGN = 8

Definition at line 39 of file vnl_alloc.h.

const vcl_size_t VNL_ALLOC_MAX_BYTES = 256

Definition at line 40 of file vnl_alloc.h.

Definition at line 41 of file vnl_alloc.h.