sbrk Questions

4

Ever since I was introduced to C, I was told that in C dynamic memory allocation is done using the functions in the malloc family. I also learned that memory dynamically allocated using malloc is a...
Wacker asked 28/7, 2021 at 22:22

6

Solved

I am having a problem with _sbrk. In a link phase of compilation i use below comand to link my objects and i get undefined reference to _sbrk. arm-none-eabi-ld -static -T linkerscript.ld -o exe tim...
Dressler asked 23/4, 2011 at 13:25

2

Solved

While I know what the Unix system call brk and function sbrk do, I have no idea what they stand for. Can anyone enlighten me?
Snowberry asked 28/7, 2011 at 22:43

1

Solved

I've heard in a lot of places (musl mailing list, macOS forums, etc.) that brk() and sbrk() are unsafe. Many of these places either don't give explanations at all, or give very vague explanations. ...
Free asked 26/3, 2019 at 23:50

3

Solved

c code: // program break mechanism // TLPI exercise 7-1 #include <stdio.h> #include <stdlib.h> void program_break_test() { printf("%10p\n", sbrk(0)); char *bl = malloc(1024 * 1024...
Illuviation asked 30/5, 2015 at 4:56

1

Solved

I'm trying to understand the sbrk() function. From what I know: sbrk(0) returns the current address of the break and doesn't increment it. sbrk(size) increments the address of the break by size b...
Bekah asked 21/1, 2019 at 17:7

2

The manual page told me so much and through it I know lots of the background knowledge of memory management of "glibc". But I still get confused. does "malloc_trim(0)"(note zero...
Deathlike asked 20/3, 2013 at 16:46

2

Solved

I have tried in my machine using sbrk(1) and then deliberately write out of bound to test page size, which is 4096 bytes. But when I call malloc(1), I get SEGV after accessing 135152 bytes, which i...
Courteous asked 13/12, 2015 at 9:51

2

Solved

I've read the linux manual about sbrk() thoroughly: sbrk() changes the location of the program break, which defines the end of the process's data segment (i.e., the program break is the first ...
Majormajordomo asked 13/12, 2015 at 7:18

2

Solved

I understand that the program break is the highest virtual memory address that the Linux OS has allocated for a process, and therefore marks the highest address of the heap. You can get the address...
Soutane asked 31/3, 2015 at 1:6

1

I have read in Advanced Unix Programming (and also in a few other books) that Linux malloc() uses the Linux system call sbrk() to request memory from the operating system. I am looking at the glib...
Girth asked 31/12, 2013 at 21:22

3

Solved

Can anyone explain how malloc() works internally? I have sometimes done strace program and I see a lot of sbrk system calls, doing man sbrk talks about it being used in malloc() but not much...
Streetlight asked 13/8, 2010 at 17:35

5

I have an issue with memory management in various operating systems. My program is a server that does some processing that could take a few GB of memory. After that, it releases most of the memory...
Dishcloth asked 21/8, 2012 at 8:20

1

Solved

Which of these calls is faster on average? I've heard that mmap is faster for smaller allocations but I haven't heard a comparison of either. Any information on performance for these would be nice....
Garlen asked 1/4, 2011 at 18:53

2

Solved

I have a custom allocator function which uses sbrk() to obtain memory. How do I release this memory when it's no longer needed? Is there a function equivalent to free() for malloc() ? or do I hav...
Ellyellyn asked 12/1, 2010 at 20:9

5

Solved

Where can I read about sbrk() in some detail? How does it exactly work? In what situations would I want to use sbrk() instead of the cumbersome malloc() and new()? btw, what is the expansion for...
Leaseback asked 16/1, 2010 at 7:16

3

Solved

the following is a very very simple version of malloc() and seems to allocate some space to me, but apart from the fact that there is no free() and I don't check if I've overrun the allocated space...
Derbyshire asked 31/10, 2009 at 18:12

4

Solved

I was thinking about how the Linux kernel implements system calls and I was wondering if someone could give me a high level view of how sbrk/brk work? I've reviewed the kernel code, but there is j...
Joan asked 15/6, 2009 at 17:50
1

© 2022 - 2024 — McMap. All rights reserved.