Top "Malloc" questions

The malloc function performs dynamic memory allocation in C and is part of the standard library.

How does Intel TBB's scalable_allocator work?

What does the tbb::scalable_allocator in Intel Threading Building Blocks actually do under the hood ? It can certainly be …

c++ multithreading stl malloc tbb
How does malloc work in a multithreaded environment?

Does the typical malloc (for x86-64 platform and Linux OS) naively lock a mutex at the beginning and release …

c linux gcc malloc x86-64
Minimizing the amount of malloc() calls improves performance?

Consider two applications: one (num. 1) that invokes malloc() many times, and the other (num. 2) that invokes malloc() few times. Both …

c malloc
Free memory allocated in a different function?

I'm trying to learn C and I'm currently trying to write a basic stack data structure, but I can't seem …

c pointers memory-management malloc free
malloced array VS. variable-length-array

There are two ways to allocate memory to an array, of which the size is unknown at the beginning. The …

c malloc variable-length-array
Does malloc lazily create the backing pages for an allocation on Linux (and other platforms)?

On Linux if I were to malloc(1024 * 1024 * 1024), what does malloc actually do? I'm sure it assigns a virtual address to …

linux malloc
C - shared memory - dynamic array inside shared struct

i'm trying to share a struct like this example: typedef struct { int* a; int b; int c; } ex; between processes, …

c memory dynamic malloc shared
Free allocated memory before return a function

I am trying to return an array using malloc in a function: char* queueBulkDequeue(queueADT queue, unsigned int size) { unsigned …

c pointers malloc free
Aligned memory management?

I have a few related questions about managing aligned memory blocks. Cross-platform answers would be ideal. However, as I'm pretty …

c memory-management malloc alignment realloc
What is aligned memory allocation?

I also want to know whether glibc malloc() does this.

malloc memory-alignment