Skip to main content

Questions tagged [memory-management]

Memory management is the act of managing computer memory by allocating portions of memory to programs as well as freeing memory so that it can be re-used.

2 votes
1 answer
83 views

RAII Wrapper For CUDA Pointers

I was recently working on my CUDA wrappers library, and this particular class is one of the oldest pieces of code in the entire project. Since that time, I added tons of other features (for example <...
NeKon's user avatar
  • 641
12 votes
1 answer
785 views

Strongly-typed CUDA device memory

When I discovered that CUDA device memory was represented by plain old void* I was horrified by having to deal with C-style type safety and resource ownership (i.e. ...
Toby Speight's user avatar
  • 88.3k
14 votes
5 answers
2k views

I implemented FFT in C

I wrote Cooley-Tukey's FFT algorithm in C. And I want to know how safe is this code? Is it just trash? How can I make it more memory safe? ...
RudraSama's user avatar
  • 181
10 votes
6 answers
2k views

k-Nearest Neighbors algorithm in C

I've been learning C for a while, and I decided to make a simple kNN program. What can I do to improve the program? Am I doing memory management right? Can the structure of the code be improved in ...
Super Tux's user avatar
  • 313
1 vote
0 answers
104 views

MemoryGraveyardDriver.sys - a kernel mode device driver managing a kilobyte of RAM for random reading/writing: Take II

(See the previous and initial iteration.) This time I have incorporated some improvement points made by G. Sliepen: driver.cpp: ...
coderodde's user avatar
  • 31.9k
8 votes
1 answer
548 views

MemoryGraveyardDriver.sys - a kernel mode device driver managing a kilobyte of RAM for random reading/writing

(See the second and next iteration.) Intro I have this GitHub repository. Basically, it does not do anything fancy: it has a byte buffer of 1Kb size, and it intercepts ...
coderodde's user avatar
  • 31.9k
4 votes
2 answers
243 views

C++ wrapper for FreeRTOS blocking queue that can handle complex objects

The FreeRTOS queue is a convenient way for intertask communication on FreeRTOS. But it is written in pain C and therefore it feels a little uncomfortable for C++ programmers. But the main problem is, ...
Mr. Clear's user avatar
  • 143
0 votes
1 answer
104 views

Implementing safe custom exception [closed]

I was trying to come up with some design to subclass built-in exceptions. For simplest case I used something like this: ...
Jakub's user avatar
  • 11
4 votes
2 answers
318 views

SPSC templatized lock free queue implementation and benchmarking

I have tried implemented a fast lock free Single producer single consumer queue in C++ for practicing concurrency and low level design concepts. I also benchmarked the code on x86_64 2.3GHz Intel ...
wwite's user avatar
  • 83
4 votes
2 answers
461 views

Arena/Region Allocator in C++ (rev 2)

2nd revision of original post: Arena/Region Allocator in C++ Context, changes Trying to get a better grasp on low-level memory management, I implemented an arena allocator in C++. It's a rough ...
HernanATN's user avatar
  • 369
9 votes
1 answer
684 views

Arena/Region allocator in C++

Update: 2nd revision on separate post: Arena/Region Allocator in C++ (rev 2) Original Post Trying to get a better grasp on low-level memory management, I implemented an arena allocator in C++. It's a ...
HernanATN's user avatar
  • 369
14 votes
2 answers
576 views

Custom implementation of `std::unique_ptr<T>`

I skimmed through the documentation on cppreference.com and put down the basic functionalities expected out of a unique_ptr<T> implementation. I coded up a ...
Quasar's user avatar
  • 639
2 votes
1 answer
84 views

I have a pytorch module that takes in some parameters and predicts the difference between one of it inputs and the target

One instance of the following module uses up to almost 75% of my vram. So, I was wondering how I could improve that without slowing down runtime too much. The code is below: ...
Jayson Meribe's user avatar
2 votes
0 answers
157 views

Allocate managed objects in C# on the native heap

This is a pretty basic class to allocate objects from the native heap. The whole process goes as follows: allocate bytes from NativeMemory.Alloc, set the method table pointer from an existing object, ...
InfiniPLEX's user avatar
2 votes
1 answer
152 views

Javascript Signals implementation

I've created my own implementation of signals in typescript, inspired by the proposed tc39 specification (https://github.com/tc39/proposal-signals) in the BOM. I think it would be great if I could use ...
enzoaicardi's user avatar

15 30 50 per page
1
2 3 4 5
44