#include <Local_Memory_Pool.h>
Collaboration diagram for ACE_Local_Memory_Pool:

Public Types | |
| typedef ACE_Local_Memory_Pool_Options | OPTIONS |
Public Member Functions | |
| ACE_Local_Memory_Pool (const ACE_TCHAR *backing_store_name=0, const OPTIONS *options=0) | |
| Initialize the pool. | |
| virtual | ~ACE_Local_Memory_Pool (void) |
| virtual void * | init_acquire (size_t nbytes, size_t &rounded_bytes, int &first_time) |
| Ask system for initial chunk of local memory. | |
| virtual void * | acquire (size_t nbytes, size_t &rounded_bytes) |
| virtual int | release (int destroy=1) |
| Instruct the memory pool to release all of its resources. | |
| virtual int | sync (ssize_t len=-1, int flags=MS_SYNC) |
| virtual int | sync (void *addr, size_t len, int flags=MS_SYNC) |
| virtual int | protect (ssize_t len=-1, int prot=PROT_RDWR) |
| virtual int | protect (void *addr, size_t len, int prot=PROT_RDWR) |
| virtual int | seh_selector (void *) |
| virtual int | remap (void *addr) |
| virtual void * | base_addr (void) const |
| virtual void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Member Functions | |
| virtual size_t | round_up (size_t nbytes) |
Protected Attributes | |
| ACE_Unbounded_Set< char * > | allocated_chunks_ |
| List of memory that we have allocated. | |
Definition at line 48 of file Local_Memory_Pool.h.
|
|
Definition at line 51 of file Local_Memory_Pool.h. Referenced by ACE_Local_Memory_Pool(). |
|
||||||||||||
|
Initialize the pool.
Definition at line 23 of file Local_Memory_Pool.cpp. References ACE_TCHAR, ACE_TRACE, and OPTIONS.
00025 {
00026 ACE_TRACE ("ACE_Local_Memory_Pool::ACE_Local_Memory_Pool");
00027 }
|
|
|
Definition at line 29 of file Local_Memory_Pool.cpp. References release().
00030 {
00031 // Free up all memory allocated by this pool.
00032 this->release ();
00033 }
|
|
||||||||||||
|
Acquire at least nbytes from the memory pool. rounded_bytes is the actual number of bytes allocated. Definition at line 51 of file Local_Memory_Pool.cpp. References ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_TEXT, ACE_TRACE, allocated_chunks_, ACE_Auto_Basic_Array_Ptr< X >::get(), ACE_Unbounded_Set< char * >::insert(), LM_ERROR, ACE_Auto_Basic_Array_Ptr< X >::release(), and round_up(). Referenced by init_acquire().
00053 {
00054 ACE_TRACE ("ACE_Local_Memory_Pool::acquire");
00055 rounded_bytes = this->round_up (nbytes);
00056
00057 char *temp = 0;
00058 ACE_NEW_RETURN (temp,
00059 char[rounded_bytes],
00060 0);
00061
00062 ACE_Auto_Basic_Array_Ptr<char> cp (temp);
00063
00064 if (this->allocated_chunks_.insert (cp.get ()) != 0)
00065 ACE_ERROR_RETURN ((LM_ERROR,
00066 ACE_TEXT ("(%P|%t) insertion into set failed\n")),
00067 0);
00068
00069 return cp.release ();
00070 }
|
|
|
Return the base address of this memory pool, 0 if base_addr never changes. Definition at line 131 of file Local_Memory_Pool.cpp.
00132 {
00133 return 0;
00134 }
|
|
|
Dump the state of an object.
Definition at line 16 of file Local_Memory_Pool.cpp. References ACE_TRACE.
00017 {
00018 #if defined (ACE_HAS_DUMP)
00019 ACE_TRACE ("ACE_Local_Memory_Pool::dump");
00020 #endif /* ACE_HAS_DUMP */
00021 }
|
|
||||||||||||||||
|
Ask system for initial chunk of local memory.
Definition at line 37 of file Local_Memory_Pool.cpp. References ACE_TRACE, and acquire().
00040 {
00041 ACE_TRACE ("ACE_Local_Memory_Pool::init_acquire");
00042 // Note that we assume that when ACE_Local_Memory_Pool is used,
00043 // ACE_Malloc's constructor will only get called once. If this
00044 // assumption doesn't hold, we are in deep trouble!
00045
00046 first_time = 1;
00047 return this->acquire (nbytes, rounded_bytes);
00048 }
|
|
||||||||||||||||
|
Change the protection of the pages of the mapped region to prot starting at addr up to len bytes. Definition at line 108 of file Local_Memory_Pool.cpp. References ACE_TRACE.
00109 {
00110 ACE_TRACE ("ACE_Local_Memory_Pool::protect");
00111 return 0;
00112 }
|
|
||||||||||||
|
Change the protection of the pages of the mapped region to prot starting at <this->base_addr_> up to len bytes. If len == -1 then change protection of all pages in the mapped region. Definition at line 101 of file Local_Memory_Pool.cpp. References ACE_TRACE, and ssize_t.
00102 {
00103 ACE_TRACE ("ACE_Local_Memory_Pool::protect");
00104 return 0;
00105 }
|
|
|
Instruct the memory pool to release all of its resources.
Definition at line 73 of file Local_Memory_Pool.cpp. References ACE_TRACE, allocated_chunks_, ACE_Unbounded_Set< char * >::begin(), ACE_Unbounded_Set< char * >::end(), and ACE_Unbounded_Set< char * >::reset(). Referenced by ~ACE_Local_Memory_Pool().
00074 {
00075 ACE_TRACE ("ACE_Local_Memory_Pool::release");
00076
00077 // Zap the memory we allocated.
00078 for (ACE_Unbounded_Set<char *>::iterator i = this->allocated_chunks_.begin ();
00079 i != this->allocated_chunks_.end ();
00080 ++i)
00081 delete [] *i;
00082 this->allocated_chunks_.reset ();
00083 return 0;
00084 }
|
|
|
Try to extend the virtual address space so that addr is now covered by the address mapping. Always returns 0 since we can't remap a local memory pool. Definition at line 124 of file Local_Memory_Pool.cpp.
00125 {
00126 return 0;
00127 // Not much can be done.
00128 }
|
|
|
Implement the algorithm for rounding up the request to an appropriate chunksize. Definition at line 138 of file Local_Memory_Pool.cpp. References ACE_TRACE, and ACE::round_to_pagesize(). Referenced by acquire().
00139 {
00140 ACE_TRACE ("ACE_Local_Memory_Pool::round_up");
00141 return ACE::round_to_pagesize (nbytes);
00142 }
|
|
|
Win32 Structural exception selector. The return value decides how to handle memory pool related structural exceptions. Returns 1, 0, or , -1. Definition at line 116 of file Local_Memory_Pool.cpp.
00117 {
00118 return 0;
00119 // Continue propagate the structural exception up.
00120 }
|
|
||||||||||||||||
|
Sync len bytes of the memory region to the backing store starting at add_. Definition at line 94 of file Local_Memory_Pool.cpp. References ACE_TRACE.
00095 {
00096 ACE_TRACE ("ACE_Local_Memory_Pool::sync");
00097 return 0;
00098 }
|
|
||||||||||||
|
Sync len bytes of the memory region to the backing store starting at <this->base_addr_>. If len == -1 then sync the whole region. Definition at line 87 of file Local_Memory_Pool.cpp. References ACE_TRACE, and ssize_t.
00088 {
00089 ACE_TRACE ("ACE_Local_Memory_Pool::sync");
00090 return 0;
00091 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 118 of file Local_Memory_Pool.h. |
|
|
List of memory that we have allocated.
Definition at line 122 of file Local_Memory_Pool.h. |
1.3.6