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.
1
vote
0answers
18 views
Handling of memorystream with streamwriter efficiency
My little program I'm working on generates charts (GUI) and (on another tab) lists the values my chart is fed from.
...
3
votes
3answers
51 views
Handle-based entity manager (that stores entities contiguously)
EDIT: The code and the algorithm have been improved. Check out my own answer below for the updated files.
I've created a generic data structure intended for game development entity management. It ...
3
votes
1answer
61 views
Traversable memory pool
I wrote this memory pool as a code sample for a job interview. It provides a per-class memory pool that can offer faster runtime performance for classes that need to be traversable and (de)allocatable ...
3
votes
2answers
31 views
Simple memory pool using no extra memory
I've borrowed the idea from the internet and I would like to know if my implementation is all right and what could be improved.
It uses the free memory to store links to each node, so there's no ...
8
votes
2answers
94 views
Image handling class
Let me start by saying that I am very happy with this code. I want to share it with other people because I think they will find it helpful, but I want to make sure I did everything in good form ...
8
votes
0answers
84 views
Yet another 'any'
This is a follow-up of 'any' class implementation. After posting my answer, I kept working on the code towards parametrizing with respect to memory management as I had promised. I ended up in some ...
5
votes
1answer
111 views
Alternative to setInterval and setTimeout
Alternative to setInterval and setTimeout
JavaScript's setTimeout and ...
9
votes
1answer
105 views
Free a binary tree without using recursion or allocating memory
As the title says, the objective is to free a binary tree without using the stack or allocating memory.
This was required for a kernel module where resources were limited.
Result has a complexity of ...
5
votes
2answers
214 views
1
vote
2answers
64 views
Capture and assign portions of char array to a struct
I am formally a PHP/C# developer and I am new to C. I need you to help to correct my coding with C.
I have a kind of following pieces of HTTP user data string.
...
4
votes
1answer
77 views
My HangMan Game
I have been trying to learn C by making a Hangman game. It's not perfect, but with C, I worry that my coding practices will not be very good. I'm also new to allocating memory myself, so I feel I ...
2
votes
2answers
72 views
split string into container on char; efficiently?
Here is my single parse code for splitting a std::string on a char into a ...
4
votes
0answers
49 views
Does this simple memory pool use too much memory?
I just wrote this pool to avoid calling malloc and free when I have some code that frequently allocates and deallocates chunks ...
3
votes
0answers
65 views
Smart pointer memory pool
Using a third-party library which utilize boost::shared_ptr for memory management. Problem is that I need to allocate very many objects and I have detected that the ...
4
votes
0answers
79 views
D3D9 leaks if any?
I am writing a D3D9 hook plugin to give back to a community that helped me learn programming. It is a community based on programming and scripting for games.
The plugin is supposed to hook d3d9.dll ...
8
votes
1answer
186 views
NSInvocation Implementation
I'm using NSInvocation as a choke point in my app to help manage threading and reduce the amount of redundant code. The purpose of this class is to pass arguments ...
6
votes
4answers
140 views
Pass pointer data across multiple functions
I would like review on the following dynamic memory allocation process and suggestions on whether there are any memory leaks. Following code is not real code in use, but I'm trying to understand ...
8
votes
4answers
229 views
Dynamic array of structs in C
Based on some code on internet, I implemented a dynamic array of structures in C.
I am really interested in some feedback on this. Maybe there are some places where it can cause memory leaks or ...
5
votes
2answers
183 views
Hex file converter
I have written a C# file reader that reads a file converts the bytes of the file to hex and writes it out to another file. It works fine but it takes 7.2GB of memory when converting a 300MB file.
...
5
votes
3answers
158 views
Adding two BigIntegers by putting mutiple digits in a linked list
Based on feedback on an earlier question, I decided to implement the addition of two big ints by putting multiple digits in a node of a linked list. Can somebody take a look at my code and let me know ...
10
votes
1answer
72 views
6
votes
1answer
80 views
WinAPI code for DNS queries
This is just some test code I'm doing to learn C++11. It compiles and runs consistently. But is anything wrong that will eventually (or under slightly different circumstances) fail?
Besides ...
1
vote
1answer
78 views
MS CA2202: Object can be disposed more then once
When running Code Analysis on my project I get the following warning:
CA2202 : Microsoft.Usage : Object 'fs' can be disposed more than once in method
I don't see the problem, and the code ...
5
votes
2answers
151 views
Adding two BigInts using linked lists in C
While trying to learn more about linked lists, I thought I should try the exercise of reading two BigInts from an input file and then adding them up. My strategy was to store the two numbers in two ...
5
votes
1answer
77 views
Linked List implementation and manipulations in C
While trying to learn some more C, I decided to implement a linked list and perform a few operations on it.
The first thing I wanted to do was read from a .csv of numbers (ex: 1,2,3,...) and store ...
7
votes
2answers
320 views
malloc implementation
Please give me some feedback to my malloc implementation. I implemented this design to understand the basic concept.
...
8
votes
2answers
394 views
Object Creation during loops
I'm trying to parse a CSV file into objects. I've already got a very efficient CSV parser (SuperCSV). The problem arises when trying to create the object with the data that is being read out.
I've ...
3
votes
1answer
195 views
Should I delete pointers in Qt5?
I am relatively new to the Qt framework and I was wondering if I should delete pointers in my program. I know that, in C++, if memory is not return it could lead to memory leak, but I am not sure if ...
2
votes
0answers
51 views
Optimize Python script for memory which opens and reads multiple times the same files
I have code that works perfectly, but it uses too much memory.
Essentially this code takes an input file (lets call it an index, that is 2 column tab-separated) that searches in a second input file ...
4
votes
3answers
138 views
Are there any memory issues with this Eigen QR wrapper?
I am writing a wrapper to Eigen QR for my personal use and I am wondering if there are any memory leaks or undocumented behavior in my implementation, especially in the function ...
5
votes
3answers
435 views
Increase performance of removing character from String
I wrote this function as part of interview practice. This method removes a character from a given string.
I was wondering how I could make this code more efficient when it comes to runtime/space. I ...
4
votes
3answers
192 views
7
votes
1answer
172 views
Tokenizing string using strtok
In this assignment, I'm supposed to split a string using strtok. (The assignment consists of the comment and the function definition; I fill in the function body.)
...
5
votes
3answers
1k views
5
votes
2answers
123 views
Linked list implementation in C
I'm learning C for mainly for fun and to get a better understanding of how things work under the hood (most of my experience lies with high-level languages). I've been following quite a few books and ...
10
votes
6answers
939 views
Small one time pad encryption program
This one time pad encryption program I have written (basically just an XOR "encryption" program) seems to be working fine, compiling nicely (gcc -o ./OTP.c), and doing what it's supposed to. However I ...
5
votes
1answer
67 views
10
votes
2answers
312 views
Linked list arithmetic
I am practicing for interviews and I tried solving the problem on my own and got a solution. I was wondering how can I improve the performance and memory on this program?
The problem performs ...
5
votes
0answers
148 views
Memory leaks in jQuery code [closed]
I've got this open source jQueryUI widget, which leaks memory whenever the DOM node is removed:
...
3
votes
1answer
99 views
MemoryCache as a message broker?
I'm in the middle of a project that was built around Microsoft's Message Queue service. During development all of our machines are on a domain and we were able to create a public queue accessible from ...
5
votes
1answer
51 views
5
votes
2answers
44 views
Invert the colors of the graph
I've heard that Lbl and Goto use up memory that they don't give back. I've noticed clearing the RAM on my calculator frees up a ...
10
votes
3answers
164 views
Please review my C code for a double linked list. Are there memory leaks I'm not seeing?
I've run my code through Valgrind and managed to not get any memory leaks based on the test code in main. I'm looking for things that I may not have thought to check for, and ways to improve my code ...
1
vote
2answers
274 views
UIGraphicsImageContext Memory Spike - Reducing Footprint
I have a UIImage Category for iOS Objective-C which tints an image based on a given UIColor value. You can take a look at the method below:
...
5
votes
1answer
242 views
Could this depth system for a game be improved?
I am still new to C++ and don't have a great insight on my coding yet, so I would be very grateful to anyone and everyone that gives advice.
Also, this code is meant to: keep all of my objects in an ...
4
votes
2answers
104 views
Critique of realloc() wrapper
Seeking code correctness and best practices.
I would like to re-allocate various amounts of memory (0 or more) such that on systems that may return NULL for an ...
2
votes
3answers
212 views
Clear ArrayList
I create class level static ArrayList by the following line.
static ArrayList<Student> studentList = null;
Then I create and fill ArrayList with some ...
4
votes
1answer
149 views
applicationDidBecomeActive: Am I causing a memory leak?
Using ARC, I'm calling the following function in an iOS app every time the app gets opened in the applicationDidBecomeActive function.
My concern is that it could ...
4
votes
1answer
208 views
Implementing `create` and `destroy` functions to replace `new` and `delete` operators
The environment I'm working in requires that all allocation is done through a special set of malloc/calloc functions and that a ...
3
votes
2answers
108 views
A good management of Java code
I'm a beginner in JEE development. I have just finished a web application that I'm going to deploy in a server.
It's a new level for me; it's not just a simple application that I can run for 10 min, ...