Knowledge

sbrk

Source ๐Ÿ“

25: 129:
amount of available space increases as the break value increases. The available space is initialized to a value of zero, unless the break is lowered and then increased, as it may reuse the same pages in some unspecified way. The break value can be automatically rounded up to a size appropriate for the
128:
the amount of space allocated for the heap segment of the calling process. The change is made by resetting the program break of the process, which determines the maximum space that can be allocated. The program break is the address of the first location beyond the current end of the data region. The
229:
subroutine returns the prior value of the program break (if the available space is increased then this prior value also points to the start of the new area). If either subroutine is unsuccessful, a value of
254:
is an emulation and has a maximum allocation of 4 megabytes. On first call an area exactly this large is allocated to hold the simulated segment. When this limit is reached, โˆ’1 is returned and the
290: 110:
were the only ways in which applications could acquire additional heap space; later versions allowed this to also be done using the
308: 472: 497: 328: 492: 96:. These functions are typically called from a higher-level memory management library function such as 144: 125: 37: 246:
Not every Unix-like system entertains the concept of having the user control the data segment. The
286: 350: 422: 374: 278:
is set and the allocated space remains unchanged if one or more of the following are true:
392: 8: 93: 92:
operating systems to control the amount of memory allocated to the heap segment of the
282:
The requested change allocates more space than is allowed by a system-imposed maximum.
210:
is used to adjust the program break value by adding a possibly negative size, while
130: 78: 303: 240: 231: 42: 486: 24: 81: 89: 46: 459: 247: 218:
parameter to zero to fetch the current value of the program break.
400:(2 ed.). X/Open Company Ltd., U.K. September 1994. p. 64 236: 98: 309:
Memory address ยง Address space in application programming
214:
is used to set the break value to the value of a pointer. Set
455: 449: 112: 85: 147:
v2 or POSIX.1-1998). They were removed in POSIX.1-2001.
394:
X/Open CAE Specification, System Interfaces and Headers
285:
The requested change sets the break value to a value
150: 16:Basic memory management system calls used in Unix 484: 143:were considered legacy even by 1997 standards ( 423:"brk, sbrk - change space allocation (LEGACY)" 385: 427:The Single UNIX ยฎ Specification, Version 2 225:subroutine returns a value of 0, and the 343: 417: 415: 485: 412: 18: 13: 289:the start address of any attached 14: 509: 221:Upon successful completion, the 151:Function signatures and behavior 23: 102:. In the original Unix system, 465: 441: 367: 321: 269: 243:is set to indicate the error. 119: 1: 351:"A new malloc(3) for OpenBSD" 314: 7: 297: 36:to comply with Knowledge's 10: 514: 331:. Free Software Foundation 375:"POSIX Memory Management" 329:"Process Memory Concepts" 145:Single UNIX Specification 287:greater than or equal to 154: 49:may contain suggestions. 34:may need to be rewritten 124:The brk and sbrk calls 498:Operating system APIs 234:is returned and the 250:implementation of 126:dynamically change 493:Memory management 131:memory management 79:memory management 64: 63: 38:quality standards 505: 477: 476: 469: 463: 453: 452: 445: 439: 438: 436: 434: 419: 410: 409: 407: 405: 399: 389: 383: 382: 371: 365: 364: 362: 360: 355: 347: 341: 340: 338: 336: 325: 304:Exec (computing) 277: 265: 261: 257: 253: 239: 228: 224: 213: 209: 203: 200: 197: 194: 191: 188: 185: 182: 179: 178:end_data_segment 176: 173: 170: 167: 164: 161: 160:<unistd.h> 158: 142: 138: 115: 109: 105: 101: 75: 69: 59: 56: 50: 27: 19: 513: 512: 508: 507: 506: 504: 503: 502: 483: 482: 481: 480: 471: 470: 466: 448: 447: 446: 442: 432: 430: 421: 420: 413: 403: 401: 397: 391: 390: 386: 373: 372: 368: 358: 356: 353: 349: 348: 344: 334: 332: 327: 326: 322: 317: 300: 275: 272: 266:always errors. 263: 259: 255: 251: 241:global variable 235: 226: 222: 217: 211: 207: 205: 204: 201: 198: 195: 192: 189: 186: 183: 180: 177: 174: 171: 168: 165: 162: 159: 156: 153: 140: 136: 122: 111: 107: 103: 97: 73: 67: 60: 54: 51: 41: 28: 17: 12: 11: 5: 511: 501: 500: 495: 479: 478: 464: 462:โ€“ System Calls 440: 411: 384: 379:blog.pr4tt.com 366: 342: 319: 318: 316: 313: 312: 311: 306: 299: 296: 295: 294: 283: 271: 268: 215: 155: 152: 149: 133:architecture. 121: 118: 62: 61: 31: 29: 22: 15: 9: 6: 4: 3: 2: 510: 499: 496: 494: 491: 490: 488: 474: 468: 461: 458:Programmer's 457: 454: โ€“  451: 444: 428: 424: 418: 416: 396: 395: 388: 380: 376: 370: 352: 346: 330: 324: 320: 310: 307: 305: 302: 301: 292: 291:shared memory 288: 284: 281: 280: 279: 267: 249: 244: 242: 238: 233: 219: 148: 146: 134: 132: 127: 117: 114: 100: 95: 91: 87: 83: 80: 76: 70: 58: 55:February 2012 48: 44: 39: 35: 32:This article 30: 26: 21: 20: 467: 443: 431:. Retrieved 426: 402:. Retrieved 393: 387: 378: 369: 357:. Retrieved 345: 333:. Retrieved 323: 273: 245: 220: 206: 135: 123: 82:system calls 72: 66: 65: 52: 43:You can help 33: 433:30 November 270:Error codes 120:Description 487:Categories 315:References 274:The error 258:is set to 77:are basic 404:9 October 335:9 October 216:increment 199:increment 90:Unix-like 47:talk page 298:See also 293:segment. 248:Mac OS X 196:intptr_t 157:#include 84:used in 473:"BRK.c" 359:13 June 94:process 460:Manual 450:brk(2) 429:. 1997 276:ENOMEM 260:ENOMEM 116:call. 99:malloc 45:. The 456:Linux 398:(PDF) 354:(PDF) 256:errno 237:errno 435:2019 406:2015 361:2018 337:2015 252:sbrk 227:sbrk 208:sbrk 190:sbrk 184:void 172:void 139:and 137:sbrk 113:mmap 108:sbrk 106:and 88:and 86:Unix 74:sbrk 71:and 264:brk 223:brk 212:brk 166:brk 163:int 141:brk 104:brk 68:brk 489:: 425:. 414:^ 377:. 262:. 232:โˆ’1 202:); 181:); 475:. 437:. 408:. 381:. 363:. 339:. 193:( 187:* 175:* 169:( 57:) 53:( 40:.

Index


quality standards
You can help
talk page
memory management
system calls
Unix
Unix-like
process
malloc
mmap
dynamically change
memory management
Single UNIX Specification
โˆ’1
errno
global variable
Mac OS X
greater than or equal to
shared memory
Exec (computing)
Memory address ยง Address space in application programming
"Process Memory Concepts"
"A new malloc(3) for OpenBSD"
"POSIX Memory Management"
X/Open CAE Specification, System Interfaces and Headers


"brk, sbrk - change space allocation (LEGACY)"
brk(2)

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

โ†‘