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 is the recommended way to align memory in C++11

I am working on a single producer single consumer ring buffer implementation.I have two requirements: Align a single heap …

c++ c++11 dynamic-memory-allocation memory-alignment
Can you define the size of an array at runtime in C

New to C, thanks a lot for help. Is it possible to define an array in C without either specifying …

c malloc dynamic-memory-allocation
Why, or when, do you need to dynamically allocate memory in C?

Dynamic memory allocation is a very important topic in C programming. However, I've been unable to find a good explanation …

c malloc dynamic-memory-allocation
CUDA allocate memory in __device__ function

Is there a way in CUDA to allocate memory dynamically in device-side functions ? I could not find any examples of …

memory-management cuda dynamic-memory-allocation
c++ what is "pointer = new type" as opposed to "pointer = new type []"?

In many tutorials, the first code samples about dynamic memory start along the lines of: int * pointer; pointer = new int; // …

c++ arrays dynamic-memory-allocation new-operator
Why use _mm_malloc? (as opposed to _aligned_malloc, alligned_alloc, or posix_memalign)

There are a few options for acquiring an aligned block of memory but they're very similar and the issue mostly …

c memory-management intel dynamic-memory-allocation
Allocating struct with variable length array member

I know I can do new char[n] to create an array of n chars. This works even when n …

c++ new-operator c++11 dynamic-memory-allocation
Malloc function (dynamic memory allocation) resulting in an error when it is used globally

#include<stdio.h> #include<string.h> char *y; y=(char *)malloc(40); // gives an error here int …

c malloc global-variables dynamic-memory-allocation
Are 'new' and 'delete' getting deprecated in C++?

I stumbled upon a quiz that involved array declaration with different sizes. The first thing that came to my mind …

c++ arrays dynamic-memory-allocation static-memory-allocation
How to Dynamically Allocate Memory Using Assembly and System Calls Under Linux

I'm looking for some good code examples of dynamic memory allocation using an assembly language under Linux and using system …

linux assembly system-calls dynamic-memory-allocation