Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-2 votes
1 answer
123 views

Why is there a heap-after-use error here? I am trying to solve a Leetcode problem in C++. I don't see any dangling pointers or refs to freed memory

I am trying to solve LeetCode 2487: Remove Nodes From Linked List, and I’ve implemented a solution in C++ that first reverses the list, then removes nodes that have a greater value node to their left (...
notSukuna's user avatar
1 vote
3 answers
132 views

Can we use memory address difference to see where an object is initialized? [closed]

I've been reading on user space and kernel space and how heap and stack grow. I'm wondering, if heap and stack memories have constant starts in memory layout, can we just use memory address difference ...
Danilo's user avatar
  • 1,042
2 votes
1 answer
132 views

Is arr in stack or heap?

I want to understand if arr here is in stack or heap. Since obj is dynamically allocated is the arr in heap? What if i do not have obj2, if i just allocate obj dynamically in main? #include <...
Rich Gg's user avatar
  • 61
3 votes
1 answer
62 views

Observing the default process heap getting created (breakpoint on heap creation)

I want to observe when the default process heap gets created, i.e. have a breakpoint and get the callstack of the creation. This has no practical background. I just want to understand the Windows ...
Thomas Weller's user avatar
2 votes
1 answer
56 views

Which option has precendence if I enable and disable FrontEndHeapDebugOptions at the same time?

The undocumented (I can't find a MSDN reference) FrontEndHeapDebugOptions Registry key has two flags: Bit 2 (0x04) for disabling the Segment Heap, thus forcing NT Heap Bit 3 (0x08) for enabling the ...
Thomas Weller's user avatar
0 votes
0 answers
133 views

Pico flash and heap - how much available and how much is used

I am learning how to program a Raspberry PicoW in C++ and I have two question about flash: How much of the flash is my programme taking up? With AtMega programming, the compiler would display this ...
Richard's user avatar
  • 391
1 vote
1 answer
76 views

Valgrind Invalid read write for all instance variables of the class

I have a class which have certain instance variables. I am getting random crashes when i run my application. Thinking memory corruption, I ran the application under valgrind, and I am able to narrow ...
Abhishek Sagar's user avatar
46 votes
3 answers
6k views

An empty program that does nothing in C++ needs a heap of 204KB but not in C

Consider this empty program: int main() { return 0; } If I compile it with C++ with g++ main.cpp && strace ./a.out, and analyze the output with strace, I observed that the last lines of the ...
ABu's user avatar
  • 12.4k
2 votes
4 answers
220 views

How to make shared pointer from raw pointer and make other shared pointers aware of it?

I have some hierarchy (through composition, not inheritance) of classes: Child and Parent. Child can have multiple parents, also Parent could do the same. I want the Child class lifetime being managed ...
Supreme Machine's user avatar
0 votes
1 answer
84 views

What's the flexibility in concrete types mentioned by Bjarne Stroustroup?

In Chapter 5.2 of the 3rd edition of A Tour of C++, Bjarne write this about concrete types. What I don't understand is what the flexibility is. Is he referring to the use of pointers in concrete ...
heretoinfinity's user avatar
2 votes
3 answers
156 views

How does nested vectors look like in memory?

So I'm considering making an global nested std::vector (vector <vector <data>> V) initially empty and later during the program, adding data to this nested vector. I'm concerned of adding ...
Sliferslacker's user avatar
0 votes
0 answers
201 views

"Heap corruption detected" error while Allocating memory inside constructor

I am currently implementing skiplist with my own vector implementation and I am getting an heap corruption not detected error testing skiplist entered Skiplist constructor Skiplist: success creating ...
jho317's user avatar
  • 23
0 votes
1 answer
56 views

C++ Primer 5th Ed - Stanley Lipmann: Question on shared_ptr.unique() used in conjunction with shared_ptr.reset()

First we have a shared_ptr defined as below: shared_ptr<int> p(new int(42)); According to the text below: The reset member is often used together with unique to control changes to the object ...
yapkm01's user avatar
  • 3,781
0 votes
0 answers
69 views

C++ Large Heap Array Initialisation

I am writing code which demands a large array. I am told that, due to the size of the array, it is best to store this in Heap Memory. I need this array to be unsigned because I am using it to store ...
Moonglum Clampflower's user avatar
0 votes
1 answer
65 views

Getting heap storage with proper alignment in C++ for overaligned type

In some use case, you'll need to allocate storage before creating objects inside this storage. Then in order to create these objects, you may need to use placement new: T *pobj = new(pstorage); yet ...
Oersted's user avatar
  • 3,003

15 30 50 per page
1
2 3 4 5
99