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.

ERROR: AddressSanitizer: heap-buffer-overflow on address X at pc Y bp Z sp W

I'm pretty new to dynamic memory management and using Fsanitise flag to find problems with memory management. I cannot use …

c++ constructor heap-memory dynamic-memory-allocation address-sanitizer
Dynamically allocated list in C++

I made a cute generic (i.e. template) List class to handle lists in C++. The reason for that is …

c++ list pointers dynamic-memory-allocation dangling-pointer
Data structure to store huge amount of data?

In my application,I have to load volumedata from set of images (MRC images) and keep the pixel data in …

c++ memory data-structures dynamic-memory-allocation
When should i use calloc over malloc

This is from Beej's guide to C "The drawback to using calloc() is that it takes time to clear memory, …

c pointers dynamic-memory-allocation
new operator for memory allocation on heap

I was looking at the signature of new operator. Which is: void* operator new (std::size_t size) throw (std::…

c++ memory-management new-operator operator-keyword dynamic-memory-allocation
Heap/dynamic vs. static memory allocation for C++ singleton class instance

My specific question is that when implementing a singleton class in C++, is there any substantial differences between the two …

c++ memory static singleton dynamic-memory-allocation
CUDA new delete

Can someone give a clear explanation of how the new and delete keywords would behave if called from __device__ or __…

cuda dynamic-memory-allocation
Calling free on a pointer twice

I have been taught in lectures, that calling free() on a pointer twice is really, really bad. I know that …

c pointers malloc free dynamic-memory-allocation
Default capacity of std::string?

When I create a std::string using the default constructor, is ANY memory allocated on the heap? I'm hoping the …

c++ string std dynamic-memory-allocation stdstring
Can you declare a pointer on the heap?

This is the method for creating a variable on the heap in C++: T *ptr = new T; ptr refers to …

c++ dynamic-memory-allocation heap-memory