Skip to main content

All Questions

Tagged with
4 votes
1 answer
961 views

C++ : Allocator for fixed size object

I'm reading "Modern C++ Design" (A. Alexandrescu, 2002). The author said "the standard memory allocator is awful for small objects", but it has been two decades after the book has ...
frozenca's user avatar
  • 1,703
6 votes
3 answers
2k views

Dynamic array implementation using C++

I implemented a basic dynamic array using C++. When deleting an element and shifting the others, the last element will be twice repeated (the original still exists after copying). I want to avoid ...
Youssef Refaat's user avatar
0 votes
1 answer
750 views

Writing a buffer that takes a header and a variable number of packets and makes a payload [closed]

I'm writing this as an exercise. I would probably use a vector as a buffer internally (the extra capacity pointer overhead is not important enough). Primarily it's an exercise in writing copy/move ...
Payal's user avatar
  • 3
6 votes
4 answers
1k views

Packing and unpacking values in a buffer

I have to deal with raw memory manipulation. For that I wrote a function which stores data one after another, and another function which reads this data and stores it into variables. More precisely: <...
tommsch's user avatar
  • 243
2 votes
0 answers
101 views

Dynamic heterogeneous container

I want to have dynamic continuous block of memory for different types, that inherit from single base class. I've written structure for that purpose. I know I play with a fire here, but I would like to ...
Šimon Gido's user avatar
2 votes
1 answer
446 views

C++ object pool that returns a smart pointer on request

...
Symlink's user avatar
  • 143
4 votes
2 answers
567 views

"observer pointer" meant to stay updated when the pointed object is moved in memory

I wasn't sure about how to name it, maybe "follow_ptr", "self_updating_ptr", or "stalking_ptr" or something on those lines. For now it's called Identifier. What I'm ...
Barnack's user avatar
  • 217
11 votes
4 answers
4k views

C++ dynamic array implementation

As a C++ beginner coming from Java, I have become increasingly confused on the topic of memory management and how to avoid memory leaks. Is the code below risking a memory leak that I'm not currently ...
ethan warco's user avatar
0 votes
1 answer
554 views

Vector Implementation C++ using RAII

I have attempted to implement a similar version of the STL Vector; several functions are missing but I'd like a few words of advice on whether I am indeed on the right track or whether I should change ...
PeePeePooPoo's user avatar
9 votes
3 answers
5k views

A Tic Tac Toe game in C++

I am a beginner programmer and have made a tic tac toe program in c++. I need some help with my memory management can anyone review and help me. This is my code ...
Vedant Matanhelia's user avatar
4 votes
1 answer
117 views

Matrix template Class

This is my 2nd shot at dynamic memory allocation. This project is for practice purposes. So many things were considered whilst writing this minimal project. I considered using placement new to ...
theProgrammer's user avatar
0 votes
1 answer
94 views

Simple C++ Dynamicly allocated Matrix with only one memory allocation [closed]

I was bothered with existing matrix allocation methods that take variable rows and columns, so I made a small class that only needs one memory allocation. ...
Eduardo Andrés Castillo Perera's user avatar
3 votes
1 answer
2k views

A custom memory allocator in c++

Recently I became interested in implementing a FORTH language interpreter. That led me to read about memory models etc. which led me to write this custom memory allocator in c++. It's very dumb as ...
Jaldhar's user avatar
  • 409
4 votes
1 answer
716 views

slab malloc/free implementation

I'm trying to implment memory allocator guided by this tutorial. I used a mix of Next-fit search and Segregated-list search. There are multiple slabs of different sizes (a slab is contagious blocks of ...
0xDEADC0DE's user avatar
11 votes
1 answer
1k views

Customization of memory class C++

I have implemented a customized memory allocation class template for an assignment. Codes are commented; Hopefully it's clear. I would love to know if there is any way to make the code more optimized. ...
starrk's user avatar
  • 369

15 30 50 per page
1 2
3
4 5
18