Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_alloc.h File Reference

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


Detailed Description

Author:
unknown
Default node allocator. 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: 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.


Variable Documentation

const int VNL_ALLOC_ALIGN = 8
 

Definition at line 38 of file vnl_alloc.h.

const vcl_size_t VNL_ALLOC_MAX_BYTES = 256
 

Definition at line 39 of file vnl_alloc.h.

Referenced by vnl_alloc::allocate(), and vnl_alloc::deallocate().

const vcl_size_t VNL_ALLOC_NFREELISTS = VNL_ALLOC_MAX_BYTES/VNL_ALLOC_ALIGN
 

Definition at line 40 of file vnl_alloc.h.


Generated at Fri May 21 01:16:06 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000