Top "Dynamic-memory-allocation" questions

Dynamic memory allocation, usually in the context of languages without garbage collection or mandatory or automatic reference counting, refers to the process or asking the operating system for a variable sized block of memory.

What and where are the stack and heap?

Programming language books explain that value types are created on the stack, and reference types are created on the heap, …

memory-management stack language-agnostic heap dynamic-memory-allocation
Difference between static memory allocation and dynamic memory allocation

I would like to know what is the difference between static memory allocation and dynamic memory allocation? Could you explain …

c memory memory-management dynamic-memory-allocation static-memory-allocation
Critical error detected c0000374 - C++ dll returns pointer off allocated memory to C#

I have a c++ dll which serving some functionality to my main c# application. Here i try to read a …

c# c++ dll dynamic-memory-allocation heap-corruption
Using Dynamic Memory allocation for arrays

How am I supposed to use dynamic memory allocations for arrays? For example here is the following array in which …

c arrays memory dynamic-memory-allocation
When and why to use malloc?

Well, I can't understand when and why it is needed to allocate memory using malloc. Here is my code : #include &…

c malloc dynamic-memory-allocation
Dynamic memory allocation for pointer arrays

I'm am trying to write a program that reads in a series of strings from a text file and stores …

c arrays dynamic-memory-allocation pointer-to-pointer
Is a destructor called when an object goes out of scope?

For example: int main() { Foo *leedle = new Foo(); return 0; } class Foo { private: somePointer* bar; public: Foo(); ~Foo(); }; Foo::~Foo() { delete …

c++ destructor dynamic-memory-allocation
dynamic allocating array of arrays in C

I don't truly understand some basic things in C like dynamically allocating array of arrays. I know you can do: …

c arrays memory dynamic-memory-allocation allocation
dynamic allocation/deallocation of 2D & 3D arrays

I know about algorithms to allocate/deallocate a 2D array dynamically, however I'm not too sure about the same for 3…

c memory dynamic memory-management dynamic-memory-allocation
Double pointer vs array of pointers(**array vs *array[])

Im not clearly sure what is the difference between those 2. My professor wrote that **array is same as *array[] and …

c pointers multidimensional-array dynamic-memory-allocation