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 (1)

0
votes
0answers
15 views

Generic class for displaying UIAlertView / UIAlertController on iOS

To address backwards compatibility for UIAlertView, I have come up with an interface that would seem to work for both iOS ...
5
votes
1answer
24 views

Converting decimal integers to a string representation in an arbitrary base between 2 and 26

This code takes an integer and returns a string representing the value in a different base. The value for the base can range between 2 and 26. I have had someone already look over this code and they ...
5
votes
1answer
62 views

Vector backed by memory pages

The purpose of this class is to wrap a std::vector in a class so that never a new object is added. We don't allocate a new object on the stack but we trying to fit ...
6
votes
4answers
204 views

Simple resizable array

In some (lower-level) parts of my codebase I often have the need to allocate resizable array storage for certain objects, that usually are not default-constructible. I created a simple class using ...
5
votes
1answer
72 views

My iPod is slower than my iPad

Many of the variables in my 2D mining game were declared as constants like so: DWConstants.h ...
1
vote
1answer
23 views

Implementation of Vertex Similarity algorithm (Blondel's Similarity Measure)

I am implementing the vertex similarity algorithm in this paper. The adjacency matrices I will be dealing with, however, will be very large, on the order of 30k vertices (I provided sample matrices in ...
2
votes
1answer
53 views

Perfect elimination ordering and high memory usage

The following code calculates a perfect elimination ordering in a special case in Haskell. I am less worried about its correctness than its high use of memory. The following code runs out of memory ...
4
votes
3answers
121 views

Implementing an ArrayList

I implemented ArrayList functionality in C as follows: ...
2
votes
2answers
67 views

RAII and code duplication in constructor/destructor

I have a class hierarchy similar to this: ...
3
votes
1answer
61 views

Program that handles program options

I'm using boost::program_options to parse input from the user. However, while the standard library makes this an easy task to do, it's causing an (in my opinion) ...
10
votes
2answers
256 views

Simple key-value store in C, take 2

Followup to Simple key-value store in C. Response to previous reviews You may want to hide the KVSstore structure Done. Add a comparison function pointer to KVSstore. If this pointer is ...
5
votes
2answers
78 views

Simple key-value store in C

I needed a simple key-value store. Here's what I came up with. Usage Use kvs_create and kvs_destroy to create stores and clean ...
3
votes
3answers
49 views

Hexadecimal to string without C++ standard library functions

For the purposes of this code review, I will use the standard library, but pretend that <cstddef> is <stddef.h>, ...
7
votes
4answers
179 views

Memory usage in Reversi board state

I'm coding a Reversi game, with an artificial intelligence using the MinMax as the search algorithm. My concern is that (most) search algorithms needs to store a lot of instances of "states", in my ...
1
vote
0answers
37 views

Comparing different string-matching functions

Here is a problem came from codingbat: Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since ...
9
votes
5answers
397 views

Static factory function and lifetime

I'm trying to teach myself C++ at the moment, after years of C# and other managed languages. The class in question is a Level in a game, and the idea is to ...
12
votes
0answers
79 views

Tiny Lua library to get char pointer from string

Background I'm using Lua with luaglut to do some OpenGL stuff. The luaglut API is almost identical to the gl/glut C APIs. Sometimes, gl functions want a pointer to some data, for example: ...
0
votes
1answer
45 views

Possible memory issue in linked list program [closed]

I am trying to write a program which will count the occurrence of words in a paragraph. The logic I am following : I am using a linked list for the purpose. And I am searching sequentially - if new ...
9
votes
3answers
484 views

Checking for palindromes using dynamic memory allocation

This is a homework assignment, but it's already done and it's not for a grade; it's meant as a refresher for the rest of the course. I've never done anything with dynamic memory allocation in C ...
6
votes
1answer
57 views

File validator configured using XML

I am making an application to check for any files that does not follow a specific pattern defined in a XML file. The application works well, but the source code is not the greatest, and memory ...
0
votes
1answer
78 views

Decrease file size of encrypted file

I am making a Cryptography application and I noticed that the encrypted file is approximately 2 times bigger because I am encoding the files in base64. Are there any file encodings that take less ...
-1
votes
1answer
53 views

Game LevelManager Memory Leak? [closed]

I have a level manager for my game I'm working on, and it's supposed to unload the previous level, and then load the next level. However, when I test it (though I'm not sure I'm testing it right) the ...
5
votes
2answers
161 views

Singleton typed memory manager

For my resources management, I wanted the objects allocated on the heap to be in a contiguous block of memory. Obviously, each data type then has to have their own chunk of memory. I could have used a ...
7
votes
3answers
367 views

Hierarchical k-ary tree in C without relying on RAM

I created a k-ary tree in C to be used as an easy and efficient way to organize "UML-like" data in embedded devices. The left node is at the lower logical level (a child) while the right node is at ...
6
votes
1answer
78 views

Possible memory leak in a for loop macro

I was reading about similar problems to the one I am having, and my guess is that I am having a 'memory leak'. I'm not sure exactly what that means, or how to correct it. Could you take a look at my ...
5
votes
3answers
101 views

CSV demographics analyzer seems to waste memory/move slowly

I'm much more fluent in JS, but I needed to sort a lot of dates, ages, genders, etc. from a tab-delimited text file so I wrote this. Could I get some tips on how to make this more efficient and more ...
1
vote
1answer
205 views

Image upload and thumbnail creation script using PHP GD

Ignoring my shocking use of the mysql_* extension (and any associated issues), could you take a look at my script that uploads an image, adds it to a database, ...
4
votes
1answer
121 views

Maintaining a car collection list in a multithreaded application

I have a multithreaded application for web scraping from an automobile website. While performing web scraping, there are many links that gives the same result, so I have to check for data redundancy. ...
2
votes
0answers
57 views

Code elimination once it is conditionally dead [closed]

A situation when programming code becomes dead dynamically or conditionally, such as here in this scenario. I don't want my code to be failure victim of branch prediction. ...
4
votes
1answer
138 views

Permutations program in Python

This code asks for letters and a number of letters per word and generates all possible permutations. Then compares those permutations with an English dictionary and creates a list with all the words ...
8
votes
3answers
224 views

Travelling Salesman in Qt

I am writing a recursive function based on the Travelling Salesman Problem. Is this a correct way of doing things, or am I creating memory leaks? Prerequisites are: a two dimensional matrix ...
6
votes
2answers
397 views

Stack challenge - improving memory consumption

I am working on this problem: Stacks Imagine, that you are employed by a software development company. You work now on the famous "D++ project", which is devoted to the creation of a new ...
5
votes
3answers
212 views

Program falls over with larger input files

I have been translating a solution from C# into VB.Net, because I know more VB and wanted to understand it better. I have a version up and running that replicates the C# performance with small input ...
2
votes
2answers
259 views

Counting occurrences of Char8s in a file

To learn some Data.Map and Control.Monad.State, I have written the following code, which should count the occurrences of ...
2
votes
0answers
118 views

Possible memory leak with WPF Custom Control?

I might have a potential memory leak with my custom control. Do I actually have one? ...
3
votes
1answer
99 views

Checking for memory leaks in data structures

I'm looking for a code review for my JavaScript code that checks if there is any memory leaks in data structures. Please include constructive criticism, as well as details on what I can do to make ...
10
votes
4answers
176 views

Bare-bones string library

After years of criticizing others, I've finally found the time and worked up the courage to polish up one of my bits of code and solicit criticisms of my own. This is a simple dynamic-string library ...
4
votes
1answer
55 views

Allocating memory and releasing the same [closed]

I was going through a code snippet... ...
3
votes
2answers
222 views

Java Manual-Reference-Counting

I have a Java game development framework. Certain classes, such as Texture, need to be disposed as soon as you don't need them - we cannot depend on the Garbage ...
3
votes
1answer
126 views

Auto-recycling C++11 polymorphic smart pointers

I've recently read an interesting blog post by Philipp Zschoche: it explains how it's possible to avoid unnecessary allocations/deallocations by keeping track of previously allocated memory in a ...
3
votes
2answers
290 views

Slow data-processing and inefficient memory usage in .NET containers

I am writing a text classifier and in order to do so I need TF/IDF values per every word of my signle text. Then I need to use the cosine similarity: \$similarity = cos(\theta) = \dfrac{A \cdot ...
2
votes
2answers
137 views

Fastest / most efficient random bit indexing in Python

Using Python/Cython, I am trying to construct an efficient way to index boolean values. I have been trying to use the bitarray and/or bitstring packages to construct a fast, non memory intensive way ...
5
votes
1answer
1k views

Hackerrank Gem Stones

I am working on some problems on Hackerrank. John has discovered various rocks. Each rock is composed of various elements, and each element is represented by a lowercase Latin letter from 'a' to ...
1
vote
0answers
40 views

Memory leak with ARM7 core? [closed]

I'm programming ARM Cortex-M3 microcontroller. I try to implement message que. Messages are added into que inside interrupt ...
7
votes
3answers
742 views

Get distinct combinations of numbers

The below code returns all distinct combinations based on the logic that 1,2,3 = 3,2,1 = 2,3,1, so it only returns 1 instance of that set of numbers. ...
3
votes
1answer
432 views

Will this class leak memory using unique_ptr, normal pointer, vectors and strings? [closed]

I haven't used C++ for a while, and have been reading more about the C++11 version. I'd like to verify what I know about C++ memory management is correct. Headers removed for simplicity. MyClass.h ...
6
votes
2answers
556 views

STL Stack Implementation

I implemented std::stack from the STL for deeper understanding of the language and memory since I still am only a beginner. I implemented the stack using a singly ...
7
votes
2answers
471 views

Deallocate all memory in a container of pointers

I want to erase all memory in a container. Currently I'm using this : ...
4
votes
4answers
869 views

Creating a custom Vector class

I'm new to C++ and am doing the C++ 4th Edition Stroustrup book. I expanded on one of the examples, and have a few questions to ask (embedded within the code: ////QUESTION 1-9). Please provide any ...
2
votes
0answers
79 views

Associative container that produces a unique, instance specific handle for each inserted object

It is not always possible to simplify program design by strictly managing the lifetimes of objects. If two objects have unpredictable lifetimes, but one of them needs to refer to the other, a simple ...