ACE_Cached_Allocator(3)

ACE_Cached_Allocator3

Create a cached memory poll with n_chunks chunks each with sizeof (type) size.

Usage

#include <ace/Malloc_T.h>
template<class T, class ACE_LOCK>
class ACE_Cached_Allocator : public ACE_New_Allocator
{
  public:
    ACE_Cached_Allocator (size_t n_chunks);
    ~ACE_Cached_Allocator (void);
    void* malloc (size_t);
    void free (void *);
  private:
    char *pool_;
        ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<T>, ACE_LOCK> free_list_;
        
};

Overview

This class enables caching of dynamically allocated, fixed-sized classes.

Public members

ACE_Cached_Allocator (size_t n_chunks);

Create a cached memory poll with n_chunks chunks each with sizeof (TYPE) size.

~ACE_Cached_Allocator (void);

clear things up.

void* malloc (size_t);

get a chunk of memory from free store.

void free (void *);

return a chunk of memory back to free store.

Private members

char *pool_;

remember how we allocate the memory in the first place so we can clear things up later.

    ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<T>, ACE_LOCK> free_list_;
    

Maintain a cached memory free list.

Library

ace

Author

Doug Schmidt and Irfan Pyarali

From libace-doc 5.0.7-4 in Debian 2.2 (Potato). Parsed by carta from the page's man source.