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

Public Types | |
| typedef ACE_Local_Memory_Pool_Options | OPTIONS |
Public Methods | |
| ACE_Local_Memory_Pool (const ACE_TCHAR *backing_store_name=0, const OPTIONS *options=0) | |
| Initialize the pool. More... | |
| 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. More... | |
| virtual void * | acquire (size_t nbytes, size_t &rounded_bytes) |
| Acquire at least NBYTES from the memory pool. ROUNDED_BYTES is the actual number of bytes allocated. More... | |
| virtual int | release (int destroy=1) |
| Instruct the memory pool to release all of its resources. More... | |
| virtual int | sync (ssize_t len=-1, int flags=MS_SYNC) |
| virtual int | sync (void *addr, size_t len, int flags=MS_SYNC) |
| Sync <len> bytes of the memory region to the backing store starting at <addr_>. More... | |
| virtual int | protect (ssize_t len=-1, int prot=PROT_RDWR) |
| virtual int | protect (void *addr, size_t len, int prot=PROT_RDWR) |
| Change the protection of the pages of the mapped region to <prot> starting at <addr> up to <len> bytes. More... | |
| virtual int | seh_selector (void *) |
| virtual int | remap (void *addr) |
| virtual void * | base_addr (void) const |
| Return the base address of this memory pool, 0 if base_addr never changes. More... | |
| virtual void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Methods | |
| virtual size_t | round_up (size_t nbytes) |
| Implement the algorithm for rounding up the request to an appropriate chunksize. More... | |
Protected Attributes | |
| ACE_Unbounded_Set< char * > | allocated_chunks_ |
| List of memory that we have allocated. More... | |
Definition at line 305 of file Memory_Pool.h.
|
|
Definition at line 308 of file Memory_Pool.h. |
|
||||||||||||
|
Initialize the pool.
Definition at line 29 of file Memory_Pool.cpp. References ACE_TCHAR, and ACE_TRACE.
00031 {
00032 ACE_TRACE ("ACE_Local_Memory_Pool::ACE_Local_Memory_Pool");
00033 }
|
|
|
Definition at line 5 of file Memory_Pool.i. References release.
00006 {
00007 // Free up all memory allocated by this pool.
00008 this->release ();
00009 }
|
|
||||||||||||
|
Acquire at least NBYTES from the memory pool. ROUNDED_BYTES is the actual number of bytes allocated.
Definition at line 36 of file Memory_Pool.cpp. References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NEW_RETURN, ACE_TRACE, allocated_chunks_, ACE_Auto_Basic_Array_Ptr::get, ACE_Unbounded_Set< char * >::insert, LM_ERROR, ACE_Auto_Basic_Array_Ptr::release, and round_up. Referenced by init_acquire.
00038 {
00039 ACE_TRACE ("ACE_Local_Memory_Pool::acquire");
00040 rounded_bytes = this->round_up (nbytes);
00041
00042 char *temp = 0;
00043 ACE_NEW_RETURN (temp,
00044 char[rounded_bytes],
00045 0);
00046
00047 ACE_Auto_Basic_Array_Ptr<char> cp (temp);
00048
00049 if (this->allocated_chunks_.insert (cp.get ()) != 0)
00050 ACE_ERROR_RETURN ((LM_ERROR,
00051 ACE_LIB_TEXT ("(%P|%t) insertion into set failed\n")),
00052 0);
00053
00054 return cp.release ();
00055 }
|
|
|
Return the base address of this memory pool, 0 if base_addr never changes.
Definition at line 40 of file Memory_Pool.i.
00041 {
00042 return 0;
00043 }
|
|
|
Dump the state of an object.
Definition at line 24 of file Memory_Pool.cpp. References ACE_TRACE.
00025 {
00026 ACE_TRACE ("ACE_Local_Memory_Pool::dump");
00027 }
|
|
||||||||||||||||
|
Ask system for initial chunk of local memory.
Definition at line 72 of file Memory_Pool.i. References ACE_TRACE, and acquire.
00075 {
00076 ACE_TRACE ("ACE_Local_Memory_Pool::init_acquire");
00077 // Note that we assume that when ACE_Local_Memory_Pool is used,
00078 // ACE_Malloc's constructor will only get called once. If this
00079 // assumption doesn't hold, we are in deep trouble!
00080
00081 first_time = 1;
00082 return this->acquire (nbytes, rounded_bytes);
00083 }
|
|
||||||||||||||||
|
Change the protection of the pages of the mapped region to <prot> starting at <addr> up to <len> bytes.
Definition at line 33 of file Memory_Pool.i. References ACE_TRACE.
00034 {
00035 ACE_TRACE ("ACE_Local_Memory_Pool::protect");
00036 return 0;
00037 }
|
|
||||||||||||
|
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 26 of file Memory_Pool.i. References ACE_TRACE, and ssize_t.
00027 {
00028 ACE_TRACE ("ACE_Local_Memory_Pool::protect");
00029 return 0;
00030 }
|
|
|
Instruct the memory pool to release all of its resources.
Definition at line 58 of file 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.
00059 {
00060 ACE_TRACE ("ACE_Local_Memory_Pool::release");
00061
00062 // Zap the memory we allocated.
00063 for (ACE_Unbounded_Set<char *>::iterator i = this->allocated_chunks_.begin ();
00064 i != this->allocated_chunks_.end ();
00065 ++i)
00066 delete [] *i;
00067 this->allocated_chunks_.reset ();
00068 return 0;
00069 }
|
|
|
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 81 of file Memory_Pool.cpp.
00082 {
00083 return 0;
00084 // Not much can be done.
00085 }
|
|
|
Implement the algorithm for rounding up the request to an appropriate chunksize.
Definition at line 88 of file Memory_Pool.i. References ACE_TRACE, and ACE::round_to_pagesize. Referenced by acquire.
00089 {
00090 ACE_TRACE ("ACE_Local_Memory_Pool::round_up");
00091 return ACE::round_to_pagesize (ACE_static_cast (off_t, nbytes));
00092 }
|
|
|
Win32 Structural exception selector. The return value decides how to handle memory pool related structural exceptions. Returns 1, 0, or , -1. Definition at line 73 of file Memory_Pool.cpp.
00074 {
00075 return 0;
00076 // Continue propagate the structural exception up.
00077 }
|
|
||||||||||||||||
|
Sync <len> bytes of the memory region to the backing store starting at <addr_>.
Definition at line 19 of file Memory_Pool.i. References ACE_TRACE.
00020 {
00021 ACE_TRACE ("ACE_Local_Memory_Pool::sync");
00022 return 0;
00023 }
|
|
||||||||||||
|
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 12 of file Memory_Pool.i. References ACE_TRACE, and ssize_t.
00013 {
00014 ACE_TRACE ("ACE_Local_Memory_Pool::sync");
00015 return 0;
00016 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 375 of file Memory_Pool.h. |
|
|
List of memory that we have allocated.
Definition at line 379 of file Memory_Pool.h. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002