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.
3
votes
0answers
57 views
Specialty tree structure - BK Tree
I've been working on a implementation of specialty tree structure called a BK-Tree (more here and here). Basically, it's a tree that allows relatively efficient querying for items within a specific ...
9
votes
3answers
255 views
Garbage collection in JavaScript multiplayer game
I am currently creating a Multiplayer Game using node.js and web sockets. The client side is receiving the positional information and applying it to all the players on the client side. Each client ...
3
votes
0answers
52 views
Pulling data from API, Allowed memory exhausted
I'm working on a project where I pull data (JSON) from an API. I would like to manipulate this data and store this as useful information in my DB (MySQL). My code is working if I would like to make, ...
3
votes
1answer
92 views
Allocating matrices for in-place modification
This code seems to be working. I am allocating matrices on the stack and passing them to functions to modify in place. Is this a standard practice, or am I doing it wrong?
Header:
...
6
votes
2answers
103 views
Converting a SecureString to a byte array
Does it allocates something that hasn't freed? Something that remains in memory? Except result byte array, ofc.
...
5
votes
1answer
44 views
ADT stack with a dynamic array (revision 1)
Here's the second draft of my ADT stack code which I posted here before after carrying out most of the improvements suggested there.
I decided to expose a function called ...
5
votes
4answers
113 views
ADT stack with a dynamic array
I'm starting to learn about data structures and coding in C. The stack is the simplest of all data structures so I'm trying to implement an ADT stack with dynamically allocated array in C. This ...
2
votes
1answer
30 views
Periodically resizing large array
I have a simple socket.io server written in node. Everything is working just fine, however I am curious whether what I am doing is acceptable.
I am especially interested in this line
...
1
vote
0answers
72 views
Implementation of a lock-free fixed-sized allocator - follow-up - with commented code
The following implementation of a lock-free fixed-size allocator is a follow-up of:
Implementation of a lock-free fixed-sized allocator
§1 - Introduction
The purpose is self-learning of atomic ...
1
vote
0answers
34 views
C++ and OpenCV memory management
I'm including all of my code, however, my major issue here is about returning the vector/array/pointer (I don't really know what to choose) in this function:
...
10
votes
2answers
241 views
Implementation of a lock-free fixed-sized allocator
This question now has a follow-up:
Implementation of a lock-free fixed-sized allocator - follow-up
I've tried implementing a lock-free fixed-size allocator while trying to learn synchronization ...
3
votes
1answer
105 views
Re-implementing memcpy
I have written an implementation of memcpy function and I want to know how good is it and if it gets the most out of the processor capabilities or not.
The reason ...
2
votes
1answer
39 views
Performance improvement on vb.net code
I need to write 5 crores records with 72 columns into text file, the file size is growing as 9.7gb .
I need to check each and every columm length need to format as according to the length as defined ...
3
votes
0answers
43 views
Cache with timeout per key
I wrote a general purpose library for in-memory cache with custom timeout for each key.
...
4
votes
1answer
63 views
Vigenère cipher 2
The following program is an updated version of this question, an implementation of the Vigenere cipher in C. It has been updated to take input from stdin and pipes, ...
4
votes
1answer
329 views
Vigenère cipher in C
For my second major project in C, I decided to write an implementation of the Vigenère cipher in C.
My program uses command line options (optarg) and can read from both a file or from a string ...
4
votes
3answers
175 views
Creating number pattern (triangle numbers) in C++ with minimum loops
We were asked to make a triangular number pattern in C++ with minimum loops:
____1_____
___2__3____
__4__5__6__
7__8__9__10
Code:
...
3
votes
3answers
97 views
4
votes
2answers
227 views
C++ Int Array/Vector Over 100 Million
Textbook style program that generates the values of two, six-sided dice; which are used to perform simple calculations. Recently, I saw an example using similar criteria that was able to utilize ...
1
vote
1answer
48 views
Calculate trapped “rain water” in structure [closed]
Supposed my input is [1, 4, 2, 5, 1, 2, 3] . Then we can create a
structure like this:
...
7
votes
1answer
75 views
2
votes
0answers
39 views
Platform independent leak/cyclic dependency detection of objects
Sometime back I came across a bug where a particular object was leaking but it was very hard to identify the root cause. I knew that it was due to a cyclic dependency (which usually indicates a bug in ...
-1
votes
1answer
119 views
C++ linked list with too many pointers
Can someone tell me how I can improve this code? It works ok, but I feel that I'm using too many pointers.
...
0
votes
1answer
107 views
Refactor C# unsafe method [closed]
I have the following two unsafe methods that I would like to refactor:
...
4
votes
1answer
49 views
3
votes
2answers
44 views
MallocRaii implementation
I'm playing around with RAII a bit lately and I wan't to know if/how I can improve this (quite simple but very helpful) class.
A word to two decisions I've made and why:
No error handling in ...
7
votes
1answer
379 views
Freeing shared memory with a signal handler
I have a homework question that asks me to get 2 integers from the user, put them in shared memory, fork a child, have the child add them and put the result in shared memory, and then the child will ...
7
votes
4answers
183 views
Matrix struct with random values allocation and deallocation
I've written this code in 2013 or 2014, I think. I've rediscovered it today in one of my folders, made some changes and now I'm left (and my 2013/2014 me as well) wondering how good it looks for other ...
5
votes
4answers
322 views
Implementation of C linked list (Queue) of C strings on mega AVR
I have been working on a mechanism to queue up strings coming into a system via a USART and have implemented it as a singly linked list. I have done my best to profile the code and its memory usage at ...
3
votes
2answers
73 views
Image processing routines for an image de-noising program
I have written a multi-language software to implement an image denoising algorithm (composed of many sub algorithms) called CANDLE. I have a C program that is part of the software and would like to ...
6
votes
1answer
70 views
Pool allocator for a scripting language parser
At the moment I'm writing a parser and interpreter for a custom scripting language, to learn more about the basic concepts involved and to get more familiar with tools like ...
4
votes
1answer
191 views
Hashing a SecureString using Cryptography Next Generation
Goal:
I needed to calculate the salted hash of a password, where the password is stored as a SecureString. There doesn't seem to be much .NET framework support for SecureString. In particular, none ...
2
votes
1answer
128 views
Generic Graph Abstract Data Type Implementation in C++
Today I tried to code up a generic graph abstract data type in C++. Precisely, I implemented the adjacency list data structure for a generic graph type. I think it seems to work with different type ...
5
votes
3answers
200 views
Adding Reversed Numbers - ADDREV on SPOJ
Today I tried solving this problem on SPOJ, in which you reverse the digits of two numbers, add them, and print the reversed digits of the sum. (When reversing, leading zeroes in the result should be ...
8
votes
1answer
73 views
Adding SecureString support to Lib2GitSharp
A library that I use doesn't support SecureString in its credentials for connecting to GitHub, so I'm submitting a pull request to add it. I know it's not ideal to ...
2
votes
4answers
351 views
Rule Of Three for a Coordinate class [closed]
I just recently got back into C++ and did a quick and simple exercise in the Rule of Three. The code for the copy constructor, overloaded assignment operator, and destructor follows below for my class ...
3
votes
1answer
102 views
Parsing large CSV in Perl
I am getting Out of Memory errors when I try to parse through a large CSV file (2.5Gb). My computer has 32Gb of Memory but Perl uses all of it up. The CSV has 2 ...
2
votes
2answers
113 views
Dynamically sized C array
I've been working in C for a while and have decided to implement my own dynamically sized array as an exercise and to actually be used in a project.
I have also written Doxygen documentation for the ...
1
vote
1answer
139 views
Timing how long garbage collection is taking in C#
I'm concerned about how much time my application could be spending during garbage collection so I'm trying to figure out how to add some code to instrument this.
Based on some examples:
...
5
votes
4answers
630 views
My own malloc() function in C
Is this acceptable? What is the next step to improve algorithm and make them more clear and faster?
...
1
vote
0answers
23 views
Container with allocator copy assignment
I am trying to write a simple Buffer container class that will behave like std::vector. It should construct only elements that ...
7
votes
3answers
56 views
Saving and restoring RadixTree object
I have a large word-file which is fixed with over 240 000 words. I need to check if a specific word exists in this list. I thought that it would be a good idea to create a ...
2
votes
1answer
134 views
Texture managing with smart pointers
I have an SDL_Wrapper which is working perfectly (it is not broken)! Please suggest how I could improve performance, and how I could make my ...
4
votes
2answers
251 views
Portable C++98 thread class akin to std::thread
I want a homegrown version of C++11's std::thread. My motivation is to avoid manual memory management of the arguments passed to the thread function. I'm restricted ...
2
votes
2answers
184 views
Creating an optimized, fully functional TextureManager in SDL
After I've discussed pointer semantics with Loki Astari previously, I finally managed to code the TextureManager class using auto_pointers. But the problem is that ...
2
votes
2answers
195 views
Using std::vectors to store textures
I need to write a TextureManager class which stores Texture objects; the problem is I'm using an ...
1
vote
2answers
97 views
C++ Disposing Textures
Recently, I've asked in a code review if my code was causing any pointer related issues. They mentioned that I had problems with my dispose method. Basically, I'm disposing textures from a texture ...
5
votes
4answers
641 views
Texture managing
I'm new to C++ and SDL, and I've written a Texture manager class whose purpose is to help me manage sprites and other textures. I have a ...
5
votes
1answer
205 views
SecureString as SqlParameter value without GC concerns
The purpose here is to make it easy to use sensitive data that is already in the form of a SecureString (example) without converting it to a ...
4
votes
3answers
218 views
Minimum coins algorithm in Ruby
I am working on a puzzle to find the minimum number of coins needed to buy a product.
I am given three coins:
1
3
5
and also a number representing the price of a product:
11
The answer here ...