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.
656 questions
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 <...
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. ...
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?
...
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 ...
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:
...
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 ...
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, ...
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:
...
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 ...
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 ...
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 ...
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 ...
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:
...
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, ...
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 ...