All Questions
Tagged with c++ memory-management
259
questions
0
votes
0
answers
50
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
218
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 (...
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 ...
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 ...
3
votes
1
answer
66
views
Reusable storage for array of objects V2
Here is a follow up on Reusable storage for array of objects, taking into account the provided answers.
The following code should be compliant at least with gcc, <...
4
votes
2
answers
486
views
Reusable storage for array of objects
My goal is to have a memory pool non-template class that is used to store arrays of objects.
The same memory pool object must be reusable for a different array (difference size, different type and/or ...
2
votes
1
answer
96
views
Yet another std::unique_ptr implementation
I know I haven't implemented many methods, and haven't specialized it for T[], but I just want to see if what I coded is good or bad.
...
7
votes
2
answers
203
views
shared_ptr implementation code - first cut
I've written an implementation of shared_ptr. It doesn't support weak_ptr (yet) but below is the code. I'd appreciate any feedback, comments.
...
-1
votes
1
answer
289
views
Copying allocated data into std::map in a smart way [closed]
I come across a problem and I solved it. The solution works but I have some feelings that there is something wrong with my solution/code.
To be clear, let's assume that cars on the race track transmit
...