Top "Allocation" questions

Memory allocation is an operation of giving a program a block of memory.

Static array vs. dynamic array in C++

What is the difference between a static array and a dynamic array in C++? I have to do an assignment …

c++ dynamic arrays static allocation
Why is the use of alloca() not considered good practice?

alloca() allocates memory on the stack rather than on the heap, as in the case of malloc(). So, when I …

c stack malloc allocation alloca
Determine size of dynamically allocated memory in C

Is there a way in C to find out the size of dynamically allocated memory? For example, after char* p = …

c memory dynamic size allocation
malloc(sizeof(int)) vs malloc(sizeof(int *)) vs (int *)malloc(sizeof(int))

I acknowledge that all three of these have a different meaning. But, I don't understand on what particular instances would …

c memory allocation malloc
Memory Allocation/Deallocation?

I have been looking at memory allocation lately and I am a bit confused about the basics. I haven't been …

c++ memory allocation memory-management
How to profile memory usage & performance with Instruments?

Of all the Instruments Trace Templates, I love using: Zombies to detect where an object is getting over-released, great for …

xcode performance profiling instruments allocation
Malloc error "can't allocate region" failed with error code 12. Any idea how to resolve this?

i am getting this error and dont know what to do with that: AppName(3786,0xa0810540) malloc: *** mmap(size=16777216) failed (error …

ios memory-management malloc allocation
Declare slice or make slice?

In Go, what is the difference between var s []int and s := make([]int, 0)? I find that both works, but …

go allocation slice
How to allocate a 2D array of pointers in C++

I'm trying to make a pointer point to a 2D array of pointers. What is the syntax and how would …

c++ pointers allocation multidimensional-array
Bad allocation exceptions in C++

In a school project of mine, I was requested to create a program without using STL In the program, I …

c++ exception mingw new-operator allocation