All Questions
Tagged with c++ memory-management
260
questions
-4
votes
0
answers
50
views
Tetris C++ Troubles with memory leaks | code provided [closed]
Memory Loss in My Tetris Game 😓
Hey everyone,
I'm pretty new to C++ and this is my first post on Code Review, so I really appreciate any help all of you can provide. I've been working on a Tetris ...
0
votes
0
answers
31
views
Presence of UB and memory usage of a std::array initialization: version with temporary array on heap
I proposed several techniques to answer to https://stackoverflow.com/q/78672409/21691539.
A classical way to answer would be to use std::index_sequence-based ...
3
votes
1
answer
221
views
Presence of UB and memory usage of a std::array initialization
I proposed several techniques to answer to https://stackoverflow.com/q/78672409/21691539.
A classical way to answer would be to use std::index_sequence-based ...
4
votes
2
answers
899
views
OpenGL: Freeing allocated memory
Here's a snippet of my code. I have a Button structure made up by 2 Figure structures, which contains vertices, colors and the relative VBOs and VAO.
I have a function to allocate the memory and one ...
2
votes
1
answer
80
views
Generic container wrapper type with a default underlying buffer (2nd rev)
This is a revision of the previous question. I was told to ask an additional question with more context for the modified code to be reviewed.
The changes:
changed from ...
5
votes
1
answer
295
views
Generic container wrapper type with a default underlying buffer
I've come up with a type that allows me to encapsulate any container class (that supports std::pmr::polymorphic_allocator<T>) with a buffer and a memory ...
3
votes
1
answer
146
views
initializing a timezone database and getting all timezone names (before main())
I have written the below small program that tries to initialize a tzdb before the main() runs. So once the main function runs, it checks the two global variables (...
8
votes
1
answer
119
views
Tracker for object construction, copy, and movement
I made an object tracker for debugging and testing purposes called ccm_counter (construction, copy, move counter). It counts constructor, copy and move calls. It ...
5
votes
1
answer
1k
views
C++ shared_ptr memory pool
I put together this little memory pool class to help avoid the costs associated with heap allocation and deallocation of objects that are frequently created & destroyed. It creates C++ standard <...
4
votes
1
answer
167
views
Track and trace allocations
When testing or debugging allocator-aware objects, it can be useful to provide allocators that can provide insight into how they get called. The Tracing_alloc from ...
8
votes
1
answer
833
views
A fixed-size dynamic array
Background
I implemented the historic std::dynarray according to the specification under the name dynamic_array in C++17. ...
4
votes
1
answer
277
views
C++ Dynamic Array Class Testing
I'm creating a basic Dynamic Array class in C++, and I'd like to know if there are any bugs/memory leaks I haven't noticed yet.
dyn_arr.h :
...
4
votes
2
answers
254
views
C++ heap allocator using an explicit free list
Description
I've written a heap allocator in C++ using an explicit free list for organization. I've also written a series of unit tests and a microbenchmark using Catch2. At time of writing I've ...
2
votes
0
answers
48
views
Reusable storage for array of objects V4
Here is a thirdfollow up on Reusable storage for array of objects, Reusable storage for array of objects V2 and Reusable storage for array of objects V3, taking into account the provided answers.
The ...
1
vote
1
answer
48
views
Reusable storage for array of objects V3
Here is a second follow up on Reusable storage for array of objects and Reusable storage for array of objects V2, taking into account the provided answers.
The following code should be compliant at ...