Knowledge (XXG)

Memory pool

Source 📝

25: 212:. The module can interpret the handle internally by dividing it into pool index, memory block index and a version. The pool and memory block index allow fast access to the corresponding block with the handle, while the version, which is incremented at each new allocation, allows detection of handles whose memory block is already freed (caused by handles retained too long). 90: 194:
Allocate memory from the pools. The function will determine the pool where the required block fits in. If all blocks of that pool are already reserved, the function tries to find one in the next bigger pool(s). An allocated memory block is represented with a
245:
Fixed-size block memory pools do not need to store allocation metadata for each allocation, describing characteristics like the size of the allocated block. Particularly for small allocations, this provides substantial space
54: 227:
Memory pools allow memory allocation with constant execution time. The memory release for thousands of objects in a pool is just one operation, not one by one if
190:
with block sizes optimized for the application deploying the module. The application can allocate, access and free memory through the following interface:
145: 76: 156: 175: 296: 239: 101: 234:
Memory pools can be grouped in hierarchical tree structures, which is suitable for special programming structures like
136:
due to performance. A more efficient solution is preallocating a number of memory blocks with the same size called the
37: 170:
to refer to a group of variable-size allocations which can be later deallocated all at once. This is also known as a
47: 41: 33: 291: 321: 113: 58: 129: 105: 133: 196: 141: 109: 116:. Dynamic memory allocation can, and has been achieved through the use of techniques such as 279: 315: 249:
Allows deterministic behavior on real-time systems avoiding the out of memory errors.
235: 187: 306: 125: 274: 301: 269: 132:
because of variable block sizes, it is not recommendable to use them in a
259:
Memory pools may need to be tuned for the application which deploys them.
128:; although established and reliable implementations, these suffer from 89: 140:. The application can allocate, access, and free blocks represented by 186:
A simple memory pool module can allocate, for example, three pools at
117: 121: 163: 88: 152: 18: 297:
PGroup PJ_POOL_GROUP — PJSIP Project 2.14-dev documentation
208:The handle can for example be implemented with an 46:but its sources remain unclear because it lacks 202:Get an access pointer to the allocated memory. 93:A high-level representation of a memory pool. 8: 231:is used to allocate memory for each object. 205:Free the formerly allocated memory block. 77:Learn how and when to remove this message 292:Fast Efficient Fixed-Sized Memory Pool 7: 162:Some systems, like the web server 14: 182:Simple memory pool implementation 23: 16:Dynamic memory allocation method 157:Transaction Processing Facility 176:region-based memory management 155:use memory pools, such as the 1: 307:Programming with Memory Pools 102:fixed-size blocks allocation 153:real-time operating systems 338: 114:dynamic memory allocation 32:This article includes a 61:more precise citations. 94: 217:Memory pool vs malloc 92: 302:A Memory Allocator 95: 34:list of references 322:Memory management 110:memory management 87: 86: 79: 329: 211: 134:real time system 104:, is the use of 82: 75: 71: 68: 62: 57:this article by 48:inline citations 27: 26: 19: 337: 336: 332: 331: 330: 328: 327: 326: 312: 311: 288: 280:Slab allocation 266: 219: 209: 184: 166:, use the term 83: 72: 66: 63: 52: 38:related reading 28: 24: 17: 12: 11: 5: 335: 333: 325: 324: 314: 313: 310: 309: 304: 299: 294: 287: 286:External links 284: 283: 282: 277: 272: 265: 262: 261: 260: 251: 250: 247: 243: 232: 218: 215: 214: 213: 206: 203: 200: 183: 180: 100:, also called 85: 84: 42:external links 31: 29: 22: 15: 13: 10: 9: 6: 4: 3: 2: 334: 323: 320: 319: 317: 308: 305: 303: 300: 298: 295: 293: 290: 289: 285: 281: 278: 276: 273: 271: 268: 267: 263: 258: 257: 256: 255: 248: 244: 241: 237: 233: 230: 226: 225: 224: 223: 216: 207: 204: 201: 198: 193: 192: 191: 189: 181: 179: 177: 173: 169: 165: 160: 158: 154: 149: 147: 143: 139: 135: 131: 130:fragmentation 127: 123: 119: 115: 111: 107: 103: 99: 91: 81: 78: 70: 60: 56: 50: 49: 43: 39: 35: 30: 21: 20: 253: 252: 228: 221: 220: 210:unsigned int 188:compile time 185: 171: 167: 161: 150: 137: 126:operator new 112:that allows 98:Memory pools 97: 96: 73: 64: 53:Please help 45: 275:Object pool 168:memory pool 138:memory pool 59:introducing 240:recursions 270:Free list 254:Drawbacks 67:June 2014 316:Category 264:See also 246:savings. 222:Benefits 146:run time 142:handles 55:improve 229:malloc 197:handle 174:; see 172:region 118:malloc 236:loops 164:Nginx 151:Many 106:pools 40:, or 238:and 120:and 108:for 144:at 124:'s 122:C++ 318:: 178:. 159:. 148:. 44:, 36:, 242:. 199:. 80:) 74:( 69:) 65:( 51:.

Index

list of references
related reading
external links
inline citations
improve
introducing
Learn how and when to remove this message

fixed-size blocks allocation
pools
memory management
dynamic memory allocation
malloc
C++
operator new
fragmentation
real time system
handles
run time
real-time operating systems
Transaction Processing Facility
Nginx
region-based memory management
compile time
handle
loops
recursions
Free list
Object pool
Slab allocation

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.