1 #include "ace/Malloc.h"
3 #if !defined (__ACE_INLINE__)
4 #include "ace/Malloc.inl"
5 #endif /* __ACE_INLINE__ */
7 #include "ace/Object_Manager.h"
8 #include "ace/Malloc_Base.h"
9 #include "ace/OS_NS_string.h"
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 // Process-wide ACE_Allocator.
14 ACE_Allocator
*ACE_Allocator::allocator_
= 0;
17 ACE_Control_Block::ACE_Malloc_Header::dump () const
19 #if defined (ACE_HAS_DUMP)
20 ACE_TRACE ("ACE_Control_Block::ACE_Malloc_Header::dump");
22 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
23 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\nnext_block = %@"), (ACE_Malloc_Header
*) this->next_block_
));
24 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\nsize = %d\n"), this->size_
));
25 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
26 #endif /* ACE_HAS_DUMP */
30 ACE_Control_Block::print_alignment_info ()
32 #if defined (ACE_HAS_DUMP)
33 ACE_TRACE ("ACE_Control_Block::print_alignment_info");
34 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("Start ---> ACE_Control_Block::print_alignment_info:\n")));
35 ACELIB_DEBUG ((LM_DEBUG
,
36 ACE_TEXT ("Sizeof ptr: %d\n")
37 ACE_TEXT ("Sizeof size_t: %d\n")
38 ACE_TEXT ("Sizeof long: %d\n")
39 ACE_TEXT ("Sizeof double: %d\n")
40 ACE_TEXT ("Sizeof ACE_MALLOC_ALIGN: %d\n")
41 ACE_TEXT ("Sizeof ACE_MALLOC_PADDING: %d\n")
42 ACE_TEXT ("Sizeof ACE_MALLOC_HEADER_SIZE: %d\n")
43 ACE_TEXT ("Sizeof ACE_MALLOC_PADDING_SIZE: %d\n")
44 ACE_TEXT ("Sizeof ACE_CONTROL_BLOCK_SIZE: %d\n")
45 ACE_TEXT ("Sizeof ACE_CONTROL_BLOCK_ALIGN_BYTES: %d\n")
46 ACE_TEXT ("Sizeof (MALLOC_HEADER): %d\n")
47 ACE_TEXT ("Sizeof (CONTROL_BLOCK): %d\n"),
54 ACE_MALLOC_HEADER_SIZE
,
55 ACE_MALLOC_PADDING_SIZE
,
56 ACE_CONTROL_BLOCK_SIZE
,
57 ACE_CONTROL_BLOCK_ALIGN_BYTES
,
58 sizeof (ACE_Malloc_Header
),
59 sizeof (ACE_Control_Block
)
61 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("End <--- ACE_Control_Block::print_alignment_info:\n")));
62 #endif /* ACE_HAS_DUMP */
66 ACE_Control_Block::dump () const
68 #if defined (ACE_HAS_DUMP)
69 ACE_TRACE ("ACE_Control_Block::dump");
71 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
72 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("Name Node:\n")));
73 for (ACE_Name_Node
*nextn
= this->name_head_
;
78 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("freep_ = %@"), (ACE_Malloc_Header
*) this->freep_
));
81 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\nMalloc Header:\n")));
82 for (ACE_Malloc_Header
*nexth
= ((ACE_Malloc_Header
*)this->freep_
)->next_block_
;
83 nexth
!= 0 && nexth
!= &this->base_
;
84 nexth
= nexth
->next_block_
)
87 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\n")));
88 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
89 #endif /* ACE_HAS_DUMP */
92 ACE_Control_Block::ACE_Name_Node::ACE_Name_Node ()
98 ACE_TRACE ("ACE_Control_Block::ACE_Name_Node::ACE_Name_Node");
101 ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name
,
110 ACE_TRACE ("ACE_Control_Block::ACE_Name_Node::ACE_Name_Node");
111 char *n
= this->name_
;
112 ACE_OS::strcpy (n
, name
);
118 ACE_Control_Block::ACE_Name_Node::name () const
123 ACE_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header ()
130 ACE_Control_Block::ACE_Name_Node::dump () const
132 #if defined (ACE_HAS_DUMP)
133 ACE_TRACE ("ACE_Control_Block::ACE_Name_Node::dump");
135 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
136 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("pointer = %@"), (const char *) this->pointer_
));
137 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\nnext_ = %@"), (ACE_Name_Node
*) this->next_
));
138 ACELIB_DEBUG ((LM_DEBUG
,
139 ACE_TEXT ("\nname_ = (%@, %C)\n"),
140 (const char *) this->name_
,
141 (const char *) this->name_
));
142 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
143 #endif /* ACE_HAS_DUMP */
147 #if defined (ACE_HAS_MALLOC_STATS)
148 ACE_Malloc_Stats::ACE_Malloc_Stats ()
153 ACE_TRACE ("ACE_Malloc_Stats::ACE_Malloc_Stats");
157 ACE_Malloc_Stats::dump () const
159 #if defined (ACE_HAS_DUMP)
160 ACE_TRACE ("ACE_Malloc_Stats::dump");
162 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
163 int const nblocks
= this->nblocks_
.value ();
164 int const ninuse
= this->ninuse_
.value ();
165 int const nchunks
= this->nchunks_
.value ();
167 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT("nblocks = %d"), nblocks
));
168 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT("\nninuse = %d"), ninuse
));
169 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT("\nnchunks = %d"), nchunks
));
170 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT("\n")));
171 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
172 #endif /* ACE_HAS_DUMP */
175 #endif /*ACE_HAS_MALLOC_STATS*/
177 ACE_END_VERSIONED_NAMESPACE_DECL