Classes | Public Member Functions | Static Public Member Functions | Public Attributes

ACE_Control_Block Class Reference

This information is stored in memory allocated by the <Memory_Pool>. More...

#include <Malloc.h>

Collaboration diagram for ACE_Control_Block:
Collaboration graph
[legend]

List of all members.

Classes

class  ACE_Malloc_Header
 This is the control block header. It's used by <ACE_Malloc> to keep track of each chunk of data when it's in the free list or in use. More...
class  ACE_Name_Node
 This class supports "named memory regions" within ACE_Malloc. More...

Public Member Functions

void dump (void) const
 Dump the state of the object.

Static Public Member Functions

static void print_alignment_info (void)
 Print out a bunch of size info for debugging.

Public Attributes

int ref_counter_
 Reference counter.
ACE_Name_Nodename_head_
 Head of the linked list of Name Nodes.
ACE_Malloc_Headerfreep_
 Current head of the freelist.
char lock_name_ [MAXNAMELEN]
 Name of lock thats ensures mutual exclusion.
char align_ [(ACE_CONTROL_BLOCK_ALIGN_BYTES)?ACE_CONTROL_BLOCK_ALIGN_BYTES:ACE_MALLOC_ALIGN]
ACE_Malloc_Header base_
 Dummy node used to anchor the freelist. This needs to come last...

Detailed Description

This information is stored in memory allocated by the <Memory_Pool>.

This class defines the "old" control block class for use in ACE_Malloc_T. This control block implementation is considerable more efficient than the "position independent" one below (ACE_PI_Control_Block) but if you are going to use it to construct a ACE_Malloc_T and access the memory from several different processes, you must "map" the underlying memory pool to the same address.

Definition at line 256 of file Malloc.h.


Member Function Documentation

void ACE_Control_Block::dump ( void   )  const

Dump the state of the object.

Definition at line 79 of file Malloc.cpp.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Control_Block::dump");

  ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name Node:\n")));
  for (ACE_Name_Node *nextn = this->name_head_;
       nextn != 0;
       nextn = nextn->next_)
    nextn->dump ();

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("freep_ = %@"), (ACE_Malloc_Header *) this->freep_));
  this->base_.dump ();

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nMalloc Header:\n")));
  for (ACE_Malloc_Header *nexth = ((ACE_Malloc_Header *)this->freep_)->next_block_;
       nexth != 0 && nexth != &this->base_;
       nexth = nexth->next_block_)
    nexth->dump ();

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
  ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}

void ACE_Control_Block::print_alignment_info ( void   )  [static]

Print out a bunch of size info for debugging.

Definition at line 43 of file Malloc.cpp.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Control_Block::print_alignment_info");
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Start ---> ACE_Control_Block::print_alignment_info:\n")));
  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("Sizeof ptr: %d\n")
              ACE_TEXT ("Sizeof size_t: %d\n")
              ACE_TEXT ("Sizeof long: %d\n")
              ACE_TEXT ("Sizeof double: %d\n")
              ACE_TEXT ("Sizeof ACE_MALLOC_ALIGN: %d\n")
              ACE_TEXT ("Sizeof ACE_MALLOC_PADDING: %d\n")
              ACE_TEXT ("Sizeof ACE_MALLOC_HEADER_SIZE: %d\n")
              ACE_TEXT ("Sizeof ACE_MALLOC_PADDING_SIZE: %d\n")
              ACE_TEXT ("Sizeof ACE_CONTROL_BLOCK_SIZE: %d\n")
              ACE_TEXT ("Sizeof ACE_CONTROL_BLOCK_ALIGN_BYTES: %d\n")
              ACE_TEXT ("Sizeof (MALLOC_HEADER): %d\n")
              ACE_TEXT ("Sizeof (CONTROL_BLOCK): %d\n"),
              sizeof (char *),
              sizeof (size_t),
              sizeof (long),
              sizeof (double),
              ACE_MALLOC_ALIGN,
              ACE_MALLOC_PADDING,
              ACE_MALLOC_HEADER_SIZE,
              ACE_MALLOC_PADDING_SIZE,
              ACE_CONTROL_BLOCK_SIZE,
              ACE_CONTROL_BLOCK_ALIGN_BYTES,
              sizeof (ACE_Malloc_Header),
              sizeof (ACE_Control_Block)
              ));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("End <--- ACE_Control_Block::print_alignment_info:\n")));
#endif /* ACE_HAS_DUMP */
}


Member Data Documentation

char ACE_Control_Block::align_[(ACE_CONTROL_BLOCK_ALIGN_BYTES)?ACE_CONTROL_BLOCK_ALIGN_BYTES:ACE_MALLOC_ALIGN]

Definition at line 379 of file Malloc.h.

Dummy node used to anchor the freelist. This needs to come last...

Definition at line 382 of file Malloc.h.

Current head of the freelist.

Definition at line 355 of file Malloc.h.

Name of lock thats ensures mutual exclusion.

Definition at line 358 of file Malloc.h.

Head of the linked list of Name Nodes.

Definition at line 352 of file Malloc.h.

Reference counter.

Definition at line 349 of file Malloc.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines