#include <Sbrk_Memory_Pool.h>
Public Types | |
typedef ACE_Sbrk_Memory_Pool_Options | OPTIONS |
Public Member Functions | |
ACE_Sbrk_Memory_Pool (const ACE_TCHAR *backing_store_name=0, const OPTIONS *options=0) | |
Initialize the pool. | |
virtual | ~ACE_Sbrk_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 void | dump (void) const |
Dump the state of an object. | |
virtual void * | base_addr (void) const |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Member Functions | |
virtual size_t | round_up (size_t nbytes) |
Definition at line 50 of file Sbrk_Memory_Pool.h.
|
Definition at line 53 of file Sbrk_Memory_Pool.h. |
|
Initialize the pool.
Definition at line 97 of file Sbrk_Memory_Pool.cpp. References ACE_TCHAR, and ACE_TRACE.
00099 { 00100 ACE_TRACE ("ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool"); 00101 } |
|
Definition at line 103 of file Sbrk_Memory_Pool.cpp.
00104 { 00105 } |
|
Acquire at least nbytes from the memory pool. rounded_bytes is the actual number of bytes allocated. Definition at line 18 of file Sbrk_Memory_Pool.cpp. References ACE_ERROR_RETURN, ACE_TRACE, LM_ERROR, MAP_FAILED, round_up(), and ACE_OS::sbrk(). Referenced by init_acquire().
00020 { 00021 ACE_TRACE ("ACE_Sbrk_Memory_Pool::acquire"); 00022 rounded_bytes = this->round_up (nbytes); 00023 // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes)); 00024 void *cp = ACE_OS::sbrk (rounded_bytes); 00025 00026 if (cp == MAP_FAILED) 00027 ACE_ERROR_RETURN ((LM_ERROR, 00028 "(%P|%t) cp = %u\n", 00029 cp), 00030 0); 00031 else 00032 // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d, new break = %u\n"), nbytes, rounded_bytes, cp)); 00033 return cp; 00034 } |
|
Return the base address of this memory pool, 0 if base_addr never changes. Definition at line 108 of file Sbrk_Memory_Pool.cpp.
00109 {
00110 return 0;
00111 }
|
|
Dump the state of an object.
Definition at line 90 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE.
00091 { 00092 #if defined (ACE_HAS_DUMP) 00093 ACE_TRACE ("ACE_Sbrk_Memory_Pool::dump"); 00094 #endif /* ACE_HAS_DUMP */ 00095 } |
|
Ask system for initial chunk of local memory.
Definition at line 76 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE, and acquire().
00079 { 00080 ACE_TRACE ("ACE_Sbrk_Memory_Pool::init_acquire"); 00081 // Note that we assume that when ACE_Sbrk_Memory_Pool is used, 00082 // ACE_Malloc's constructor will only get called once. If this 00083 // assumption doesn't hold, we are in deep trouble! 00084 00085 first_time = 1; 00086 return this->acquire (nbytes, rounded_bytes); 00087 } |
|
Change the protection of the pages of the mapped region to prot starting at addr up to len bytes. Definition at line 67 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE.
00068 { 00069 ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect"); 00070 return 0; 00071 } |
|
Change the protection of the pages of the mapped region to prot starting at Definition at line 60 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE, and ssize_t.
00061 { 00062 ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect"); 00063 return 0; 00064 } |
|
Instruct the memory pool to release all of its resources.
Definition at line 39 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE.
00040 { 00041 ACE_TRACE ("ACE_Sbrk_Memory_Pool::release"); 00042 return 0; 00043 } |
|
Implement the algorithm for rounding up the request to an appropriate chunksize. Definition at line 116 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE, and ACE::round_to_pagesize(). Referenced by acquire().
00117 { 00118 ACE_TRACE ("ACE_Sbrk_Memory_Pool::round_up"); 00119 return ACE::round_to_pagesize (nbytes); 00120 } |
|
Sync len bytes of the memory region to the backing store starting at addr. Definition at line 53 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE.
00054 { 00055 ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync"); 00056 return 0; 00057 } |
|
Sync len bytes of the memory region to the backing store starting at Definition at line 46 of file Sbrk_Memory_Pool.cpp. References ACE_TRACE, and ssize_t.
00047 { 00048 ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync"); 00049 return 0; 00050 } |
|
Declare the dynamic allocation hooks.
Definition at line 105 of file Sbrk_Memory_Pool.h. |