OS_Memory.h File Reference

#include "ace/OS_Errno.h"
#include "ace/Basic_Types.h"
#include "ace/os_include/os_stddef.h"
#include "ace/OS_NS_stdlib.h"

Include dependency graph for OS_Memory.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Efficiently compute aligned pointers to powers of 2 boundaries.

uintptr_t ACE_align_binary (uintptr_t ptr, uintptr_t alignment)
 Return the next integer aligned to a required boundary.
char * ACE_ptr_align_binary (char const *ptr, uintptr_t alignment)
 Return the next address aligned to a required boundary.
char * ACE_ptr_align_binary (unsigned char const *ptr, uintptr_t alignment)
 Return the next address aligned to a required boundary.

Defines

#define ACE_MALLOC_FUNC   ::malloc
#define ACE_CALLOC_FUNC   ::calloc
#define ACE_FREE_FUNC   ::free
#define ACE_REALLOC_FUNC   ::realloc
#define ACE_del_bad_alloc
#define ACE_NEW_RETURN(POINTER, CONSTRUCTOR, RET_VAL)
#define ACE_NEW(POINTER, CONSTRUCTOR)
#define ACE_NEW_NORETURN(POINTER, CONSTRUCTOR)
#define ACE_throw_bad_alloc

Variables

ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef void * 
ACE_MALLOC_T


Detailed Description

Id
OS_Memory.h 80826 2008-03-04 14:51:23Z wotte

Author:
Doug Schmidt <schmidt@cs.wustl.edu>

Jesper S. M|ller<stophph@diku.dk>

and a cast of thousands...

Definition in file OS_Memory.h.


Define Documentation

#define ACE_CALLOC_FUNC   ::calloc

Definition at line 50 of file OS_Memory.h.

Referenced by ACE_OS::calloc().

#define ACE_del_bad_alloc

Definition at line 95 of file OS_Memory.h.

#define ACE_FREE_FUNC   ::free

Definition at line 53 of file OS_Memory.h.

Referenced by ACE_OS::free().

#define ACE_MALLOC_FUNC   ::malloc

Definition at line 47 of file OS_Memory.h.

Referenced by ACE_OS::calloc(), and ACE_OS::malloc().

#define ACE_NEW ( POINTER,
CONSTRUCTOR   ) 

Value:

do { POINTER = new CONSTRUCTOR; \
     if (POINTER == 0) { errno = ENOMEM; return; } \
   } while (0)

Definition at line 225 of file OS_Memory.h.

Referenced by ACE_Activation_Queue::ACE_Activation_Queue(), ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T(), ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository(), ACE_Bounded_Set< T >::ACE_Bounded_Set(), ACE_Bounded_Stack< T >::ACE_Bounded_Stack(), ACE_Cached_Allocator< T, ACE_LOCK >::ACE_Cached_Allocator(), ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >::ACE_Cached_Connect_Strategy(), ACE_Caching_Strategy_Adapter< ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION >::ACE_Caching_Strategy_Adapter(), ACE_Configuration_Heap::ACE_Configuration_Heap(), ACE_Dynamic_Cached_Allocator< ACE_LOCK >::ACE_Dynamic_Cached_Allocator(), ACE_Get_Opt::ACE_Get_Opt(), ACE_Handler_Caching_Utility< KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES >::ACE_Handler_Caching_Utility(), ACE_InputCDR::ACE_InputCDR(), ACE_IOStream< STREAM >::ACE_IOStream(), ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::ACE_Lock_Adapter(), ACE_Logging_Strategy::ACE_Logging_Strategy(), ACE_Message_Queue< ACE_SYNCH_USE >::ACE_Message_Queue(), ACE_Naming_Context::ACE_Naming_Context(), ACE_Null_Caching_Utility< KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES >::ACE_Null_Caching_Utility(), ACE_Object_Manager::ACE_Object_Manager(), ACE_OS_Exit_Info::ACE_OS_Exit_Info(), ACE_OutputCDR::ACE_OutputCDR(), ACE_Pair_Caching_Utility< KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES >::ACE_Pair_Caching_Utility(), ACE_Process_Options::ACE_Process_Options(), ACE_Reactor::ACE_Reactor(), ACE_Recyclable_Handler_Caching_Utility< KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES >::ACE_Recyclable_Handler_Caching_Utility(), ACE_Refcounted_Recyclable_Handler_Caching_Utility< KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES >::ACE_Refcounted_Recyclable_Handler_Caching_Utility(), ACE_Sample_History::ACE_Sample_History(), ACE_System_Time::ACE_System_Time(), ACE_Task< ACE_SYNCH_USE >::ACE_Task(), ACE_Task_Ex<, ACE_MESSAGE_TYPE >::ACE_Task_Ex(), ACE_Thread_Descriptor::ACE_Thread_Descriptor(), ACE_Thread_Exit_Maybe::ACE_Thread_Exit_Maybe(), ACE_Thread_Timer_Queue_Adapter< TQ >::ACE_Thread_Timer_Queue_Adapter(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::ACE_Timer_Hash_T(), ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK >::ACE_Timer_Heap_T(), ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK >::ACE_Timer_List_T(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::ACE_Timer_Queue_T(), ACE_Service_Gestalt::add_processed_static_svc(), ACE_Locked_Free_List< T, ACE_LOCK >::alloc(), ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK >::grow_heap(), ACE_Arg_Shifter_T< CHAR_TYPE >::init(), ACE_Priority_Reactor::init_bucket(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::open_i(), ACE_Bounded_Set< T >::operator=(), ACE_Bounded_Stack< T >::operator=(), ACE_Utils::UUID::UUID(), and ACE_Utils::UUID_Generator::UUID_Generator().

#define ACE_NEW_NORETURN ( POINTER,
CONSTRUCTOR   ) 

Value:

do { POINTER = new CONSTRUCTOR; \
     if (POINTER == 0) { errno = ENOMEM; } \
   } while (0)

Definition at line 229 of file OS_Memory.h.

Referenced by ACE_Log_Msg::ACE_Log_Msg(), ACE_Log_Record::ACE_Log_Record(), ACE_Service_Config::ACE_Service_Config(), ACE_OS::fork_exec(), ACE_Registry_ImpExp::import_config(), ACE_Log_Msg::log(), ACE_Service_Gestalt::Processed_Static_Svc::Processed_Static_Svc(), ACE_SOCK_SEQPACK_Connector::shared_connect_start(), ACE_SOCK_SEQPACK_Acceptor::shared_open(), ACE_Utils::UUID::to_string(), and ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, >::wrap_with_mbs_i().

#define ACE_NEW_RETURN ( POINTER,
CONSTRUCTOR,
RET_VAL   ) 

Value:

do { POINTER = new CONSTRUCTOR; \
     if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
   } while (0)

Definition at line 221 of file OS_Memory.h.

Referenced by ACE_Local_Memory_Pool::acquire(), ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK >::alloc_node(), ACE_Notification_Queue::allocate_more_buffers(), ACE_Thread_Manager::append_thr(), ACE_OS::argv_to_string(), ACE_Thread_Descriptor::at_exit(), ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::begin_impl(), ACE_Hash_Map_Manager_Ex_Adapter< KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR >::begin_impl(), ACE_Active_Map_Manager_Adapter< KEY, VALUE, KEY_ADAPTER >::begin_impl(), ACE_Map_Impl< KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY >::begin_impl(), ACE_New_Allocator::calloc(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::cancel(), ACE_NS_WString::char_rep(), ACE_Message_Block::clone(), ACE_Map_Manager_Reverse_Iterator_Adapter< T, KEY, VALUE >::clone(), ACE_Map_Manager_Iterator_Adapter< T, KEY, VALUE >::clone(), ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter< T, KEY, VALUE, HASH_KEY, COMPARE_KEYS >::clone(), ACE_Hash_Map_Manager_Ex_Iterator_Adapter< T, KEY, VALUE, HASH_KEY, COMPARE_KEYS >::clone(), ACE_Active_Map_Manager_Reverse_Iterator_Adapter< T, VALUE >::clone(), ACE_Active_Map_Manager_Iterator_Adapter< T, VALUE >::clone(), ACE_Map_Impl_Reverse_Iterator_Adapter< T, IMPLEMENTATION, ENTRY >::clone(), ACE_Map_Impl_Iterator_Adapter< T, IMPLEMENTATION, ENTRY >::clone(), ACE_Stream<>::control(), ACE_Filecache::create(), ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue(), ACE_Message_Queue_Factory<>::create_deadline_message_queue(), ACE_Message_Queue_Factory<>::create_laxity_message_queue(), ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(), ACE_Service_Config::create_service_type_impl(), ACE_Message_Queue_Factory<>::create_static_message_queue(), ACE_Base64::decode(), ACE_OS::dlsym(), ACE_Message_Block::duplicate(), ACE_Base64::encode(), ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::end_impl(), ACE_Hash_Map_Manager_Ex_Adapter< KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR >::end_impl(), ACE_Active_Map_Manager_Adapter< KEY, VALUE, KEY_ADAPTER >::end_impl(), ACE_Map_Impl< KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY >::end_impl(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_deadline(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_head(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_prio(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_tail(), ACE_Configuration_Heap::enumerate_sections(), ACE_Configuration_Heap::enumerate_values(), ACE_OS::event_init(), ACE::execname(), ACE_Capabilities::fillent(), ACE_Utils::UUID_Generator::generate_UUID(), ACE_Configuration_Heap::get_binary_value(), ACE::get_ip_interfaces(), ACE_SOCK_SEQPACK_Association::get_local_addrs(), ACE_SOCK_SEQPACK_Association::get_remote_addrs(), ACE_OutputCDR::grow_and_adjust(), ACE_Sig_Handlers::handler(), ACE_Registry_ImpExp::import_config(), ACE_OS_Object_Manager::init(), ACE_Object_Manager::init(), ACE_Logging_Strategy::init(), ACE_Log_Msg_Manager::init_backend(), ACE_Service_Gestalt::init_i(), ACE_Service_Gestalt::init_svc_conf_file_queue(), ACE_Service_Gestalt::insert(), ACE_Cleanup_Info_Node::insert(), ACE_Filecache::insert_i(), ACE_Thread_Manager::instance(), ACE_Thread_Exit::instance(), ACE_DLL_Singleton_T< TYPE, ACE_LOCK >::instance(), ACE_Unmanaged_TSS_Singleton< TYPE, ACE_LOCK >::instance(), ACE_TSS_Singleton< TYPE, ACE_LOCK >::instance(), ACE_Unmanaged_Singleton< TYPE, ACE_LOCK >::instance(), ACE_Singleton< TYPE, ACE_LOCK >::instance(), ACE_Sig_Handlers_Set::instance(), ACE_Service_Repository::instance(), ACE_Reactor::instance(), ACE_Process_Manager::instance(), ACE_OS_Object_Manager::instance(), ACE_Object_Manager::instance(), ACE_Log_Msg::instance(), ACE_Framework_Repository::instance(), ACE_Filecache::instance(), ACE_ODB::instance(), ACE_DLL_Manager::instance(), ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::internal_create(), ACE_Bound_Ptr_Counter< ACE_LOCK >::internal_create(), ACE_OS::ioctl(), ACE::ldname(), ACE_Codeset_Registry::locale_to_registry_i(), ACE_Log_Msg::log_hexdump(), ACE_Creation_Strategy< SVC_HANDLER >::make_svc_handler(), ACE_DLL_Strategy< SVC_HANDLER >::make_svc_handler(), ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::make_svc_handler(), ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::make_svc_handler(), ACE_TSS< TYPE >::make_TSS_TYPE(), ACE_New_Allocator::malloc(), ACE_SOCK_Dgram_Bcast::mk_broadcast(), ACE_Log_Record::msg_data(), ACE_Configuration_Heap::new_section(), ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::nonblocking_connect(), ACE_Stream<>::open(), ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >::open(), ACE_Singleton_Strategy< SVC_HANDLER >::open(), ACE_Service_Repository::open(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::open(), ACE_Naming_Context::open(), ACE_Module< ACE_SYNCH_USE >::open(), ACE_Framework_Repository::open(), ACE_DLL_Manager::open(), ACE_Strategy_Connector< SVC_HANDLER, >::open(), ACE_Configuration_Heap::open(), ACE_Oneshot_Acceptor< SVC_HANDLER, >::open(), ACE_Strategy_Acceptor< SVC_HANDLER, >::open(), ACE_DLL_Manager::open_dll(), ACE_Configuration_Heap::open_simple_section(), ACE_Malloc_Lock_Adapter_T< ACE_Process_Semaphore >::operator()(), ACE_Malloc_Lock_Adapter_T< ACE_Null_Mutex >::operator()(), ACE_Malloc_Lock_Adapter_T< ACE_LOCK >::operator()(), operator>>(), ACE_Service_Gestalt::parse_args_i(), ACE_Log_Record::print(), ACE_Service_Gestalt::process_directive_i(), ACE_OS::putmsg(), ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rbegin_impl(), ACE_Hash_Map_Manager_Ex_Adapter< KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR >::rbegin_impl(), ACE_Active_Map_Manager_Adapter< KEY, VALUE, KEY_ADAPTER >::rbegin_impl(), ACE_Map_Impl< KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY >::rbegin_impl(), ACE_InputCDR::read_string(), ACE_InputCDR::read_wstring(), ACE_SPIPE_Stream::recv(), ACE_SOCK_IO::recv(), ACE_SOCK_Dgram::recv(), ACE_Pipe::recv(), ACE_FILE_IO::recv(), ACE_DEV_IO::recv(), ACE::recv(), ACE_SOCK_IO::recvv(), ACE_FILE_IO::recvv(), ACE_Thread_Manager::register_as_terminated(), ACE_Sig_Handlers::register_handler(), ACE_Codeset_Registry::registry_to_locale_i(), ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rend_impl(), ACE_Hash_Map_Manager_Ex_Adapter< KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR >::rend_impl(), ACE_Active_Map_Manager_Adapter< KEY, VALUE, KEY_ADAPTER >::rend_impl(), ACE_Map_Impl< KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY >::rend_impl(), ACE_String_Base< CHAR >::rep(), ACE_Streambuf::reset_get_buffer(), ACE_Streambuf::reset_put_buffer(), ACE_Process_Manager::resize(), ACE_Remote_Name_Space::resolve(), ACE_Local_Name_Space<, ACE_LOCK >::resolve_i(), ACE_OS::sema_init(), ACE_SPIPE_Stream::send(), ACE_SOCK_IO::send(), ACE_SOCK_Dgram::send(), ACE_Pipe::send(), ACE_FILE_IO::send(), ACE_DEV_IO::send(), ACE::send(), ACE_Process_Options::setenv(), ACE_Process_Manager::spawn(), ACE_Thread_Manager::spawn_i(), ACE_OS::string_to_argv(), ACE::strnew(), ACE::strnnew(), ACE_SOCK_Dgram_Mcast::subscribe_ifs(), ACE_OS::thr_create(), ACE_Utils::UUID::to_string(), ACE_SOCK_Dgram_Mcast::unsubscribe_ifs(), ACE_NS_WString::ushort_rep(), ACE_Process_Manager::wait(), ACE_Thread_Manager::wait_grp(), ACE_Thread_Manager::wait_task(), ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, >::wrap_with_mbs_i(), ACE_OutputCDR::write_octet_array_mb(), and ACE_Svc_Conf_Lexer::yylex().

#define ACE_REALLOC_FUNC   ::realloc

Definition at line 56 of file OS_Memory.h.

Referenced by ACE_OS::realloc().

#define ACE_throw_bad_alloc

Value:

void* gcc_will_complain_if_literal_0_is_returned = 0; \
  return gcc_will_complain_if_literal_0_is_returned

Definition at line 234 of file OS_Memory.h.

Referenced by ACE_Refcounted_Auto_Ptr_Rep< X, ACE_LOCK >::create(), ACE_Bound_Ptr_Counter< ACE_LOCK >::create_strong(), ACE_Bound_Ptr_Counter< ACE_LOCK >::create_weak(), and ACE_Svc_Handler<, >::operator new().


Function Documentation

uintptr_t ACE_align_binary ( uintptr_t  ptr,
uintptr_t  alignment 
) [inline]

Return the next integer aligned to a required boundary.

Parameters:
ptr the base pointer
alignment the required alignment

Definition at line 290 of file OS_Memory.h.

Referenced by ACE_ptr_align_binary(), ACE_OutputCDR::adjust(), and ACE_SizeCDR::adjust().

00291 {
00292   uintptr_t const tmp = alignment - 1;
00293   return (ptr + tmp) & (~tmp);
00294 }

char* ACE_ptr_align_binary ( unsigned char const *  ptr,
uintptr_t  alignment 
) [inline]

Return the next address aligned to a required boundary.

Definition at line 326 of file OS_Memory.h.

References ACE_ptr_align_binary().

00327 {
00328   return
00329     ACE_ptr_align_binary (reinterpret_cast<char const *> (ptr), alignment);
00330 }

char* ACE_ptr_align_binary ( char const *  ptr,
uintptr_t  alignment 
) [inline]

Return the next address aligned to a required boundary.

Definition at line 317 of file OS_Memory.h.

References ACE_align_binary().

Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_Message_Block::ACE_Message_Block(), ACE_ptr_align_binary(), ACE_InputCDR::adjust(), ACE_InputCDR::align_read_ptr(), ACE_CDR::grow(), ACE_CDR::mb_align(), ACE_CDR::swap_2_array(), and ACE_CDR::swap_4_array().

00318 {
00319   return
00320     reinterpret_cast<char *> (
00321       ACE_align_binary (reinterpret_cast<uintptr_t> (ptr), alignment));
00322 }


Variable Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef void* ACE_MALLOC_T

Definition at line 64 of file OS_Memory.h.

Referenced by ACE_OS::free(), ACE_OS::realloc(), and ACE_INET_Addr::string_to_addr().


Generated on Tue Feb 2 17:25:14 2010 for ACE by  doxygen 1.4.7