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.

learn more… | top users | synonyms

9
votes
1answer
74 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
200 views

Conditional jump or move depends on uninitialised value

Please review the following code: ...
1
vote
2answers
48 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
66 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
70 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
36 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
55 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
63 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
170 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
121 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
179 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
156 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
140 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 ...
9
votes
1answer
60 views

Pascal Triangle program in C

I've created a program to calculate Pascal's triangle: ...
6
votes
1answer
66 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
54 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
121 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
75 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
291 views

malloc implementation

Please give me some feedback to my malloc implementation. I implemented this design to understand the basic concept. ...
7
votes
2answers
379 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
171 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
46 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
124 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
400 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
150 views
7
votes
1answer
131 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
554 views
5
votes
2answers
113 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
821 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
63 views

Input memory buffer exceeding situation handling

Please review the following code: ...
10
votes
2answers
266 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
122 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
81 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
49 views

Shorten a sorting function

I have this function: ...
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
160 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
215 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
234 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
96 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
176 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
140 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
191 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
107 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, ...
4
votes
2answers
104 views

Memory Management For Small Allocations in C

This is my first attempt at doing this, so I know this code is probably bad. I would like to know exactly what is wrong with it, so I won't make the same mistakes again. This code is for a program ...
0
votes
1answer
961 views

Breadth-first tree traversal using STL list

I am writing code for breadth-first search of a tree with C++'s STL. Please help as I am new to the STL. ...
1
vote
1answer
556 views

C++ Memory Pool and Block Alignment

I have written a memory pool (pool_allocator) that was described in a book I am reading (Game Engine Architecture). The interface is pretty basic: the ...
3
votes
2answers
1k views

reading unlimited input strings in C

The idea is to write a function that reads string of unknown size from stdin, keep it in dynamically allocated array of unknown size and return copy of that array. Is this the right approach? Could I ...
3
votes
1answer
362 views

Proper way of using IXMLDOMDocument

I am trying to use IXMLDOMDocument for XML reading/writing. I am not good COM, and I am not aware that I am doing things right or wrong. I am very unsure that there could be some problems with COM ...
3
votes
1answer
188 views

Does this C binary search tree have memory leaks?

I am new to C, so I have been trying to get practice doing some coding. Usually I use languages like Java, python, ruby, etc: Garbage collected languages. So manually cleaning up is new to me and I ...
3
votes
2answers
230 views

Hash Table: adding and finding functions

I made this function to teach myself about hash tables. Any ideas? I commented out free(addition) because it was giving me a compiler error, but I need to figure ...