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)

6
votes
1answer
42 views

Fixed-size block allocator

I have written a fixed-size block allocator implementation and would like some feedback as to what I could improve in my code and coding practices. Your comments or notes are welcomed! An auxiliary ...
5
votes
2answers
136 views

Edge cases for simulated malloc function

I'm trying to simulate the malloc function in C by using mmap and having 2 linked lists to act as memory blocks. The program ...
0
votes
0answers
17 views

Small web service using scotty

I'm writing a small tool that allows to manually protocol dial-in-actions. That means a user can say he dials in to a site or he dials out of a site. (What this means is not important for the sake of ...
3
votes
1answer
56 views

Reading from a CSV file in C++

I wrote this code to read from a CSV text file (containing data such as 12,3,568,48,3,8 with no more than 3 digits to each number). It stores the numbers as char arrays in the vector ...
4
votes
1answer
53 views

Smart pointer mark II - my answer to C++ 11 shared_ptr

I am writing this smart pointer as a learning exercise. Any feedback would be most appreciated. Any flaws? Have I missed any test cases? smart_pointer.hpp: ...
5
votes
0answers
39 views

Memory Segmentation Simulation

I recently have been working on a project to simulate segmentation in memory. I wanted to create everything from scratch; not use pre-built data structures. I create a memory object that allows for ...
2
votes
1answer
51 views

URL-finder using a lot of memory

I'm trying to get the URL of the browser with Mac OS X app. I wrote some AppleScript and am trying to use it in Cocoa. The problem is, when I watch it with instruments, memory is increasing, and at ...
4
votes
0answers
93 views

malloc(), free(), realloc() using brk() and sbrk()

I recoded malloc() by using brk() and sbrk(). I just want some "reviews" to see if it is ...
1
vote
3answers
32 views

Word/expression list frequency distribution

I have another Python issue, creating a frequency distribution out of a text matching a predefined wordlist. In fact, I work with more than 100,000 text files (each consisting of about 15,000 words), ...
3
votes
1answer
30 views

MemoryWriter Helper class

I have created this memory writer helper to ease the write into memory process and I want your suggestions regarding it. I am very new to C++ but have 6 years knowledge of .NET languages like VB and ...
3
votes
1answer
88 views

Memory leak using UserControls

I seem to have a memory leak on this method but can't figure it out. This method is called every 10sec by a timer which acts like a refresh. ...
0
votes
0answers
124 views

Android app with an ActionBar, a ViewPager and an AsyncTask

I'm new at Android and Java development and I've put together a demo app to start learning, which is made of: a main activity extending ActionBarActivity, in ...
6
votes
3answers
238 views

Reading, echoing, and returning integers in an array

I was wanting some clarification on my code, as I am new to pointers in C. I am trying to return an array from a simple function just so I can understand exactly what it is that I'm doing. Here is ...
1
vote
2answers
24 views

String appending function (location-independent)

Very useful operation that hasn't been merged into a function.. until now. This is supposed to insert a substring into a previously d.allocated source string. ...
2
votes
3answers
89 views

Creating lightning bolt effects

Which one of these are better for the memory? ...
4
votes
2answers
92 views

Inefficient hash map operation provokes OutOfMemory: Java heap space error

I know I can increase the size of the heap but that seems like a poor solution. This program runs correctly on small files but when run on large data sets it crashes with the OutOfMemory: Java heap ...
8
votes
1answer
97 views

C# SHA512 Memory Issue

I need an implementation of PBKDF2 in C#. There is already a class Rfc2898DeriveBytes, but it uses SHA1, and I need SHA512. The problem that I faced with during ...
1
vote
1answer
33 views

Memory searcher function test

This is part of the project I started just now. It is a function that returns the offset address of a first occurrence of a string match into a given range of memory blocks. ...
8
votes
2answers
104 views

Finding a password with brute force

The purpose of this code is to find a password with brute force cracking where as it will try all the possible combinations until it finds the correct password. For example, it will start like a then ...
3
votes
1answer
54 views

Sieve of Eratosthenes in Scheme (R7RS)

I've seen many implementations of Sieve of Eratosthenes in Scheme, but I thought I'd try to write one that is both space- and time-efficient: Space-efficient: I use R7RS bytevectors as a bitset, ...
8
votes
1answer
90 views

Rotating and printing an image

I carefully used smart pointer to avoid memory leaks and dangling pointers, but someone says my code has memory leaks. Is it true? If so, how can I fix it? ...
6
votes
2answers
73 views

Inferring Memory Alignment

The following code is intended to infer the alignment of double. My questions include: Is there a better to do this? Either by refining the code or using an ...
5
votes
2answers
166 views

Rotate an image (2D array) by 90 degrees recursively with low memory usage

I'm looking for comments on coding style, passing arguments, ...etc. ...
3
votes
3answers
98 views

Finding the size of a file

I recently learned that sometimes, when running code, the compiler(or whatever it is) ignores when there isn't enough memory for say, a string, and interacts with the string normally. Yes, I know ...
8
votes
4answers
239 views

“Restaurant” HackerRank challenge in C

I don't write C all that often, so things to look for would be memory leaks and such. I also recognize that I'm not validating the user input as well as I could - I could use some feedback on how I ...
4
votes
1answer
135 views

Increasing performance and accuracy in multithreaded loop

I was wondering if the following set up will return consistent result, i.e. no thread function call will be skipped. Also, is there any way to improve the threaded loop? Note the first loop is the ...
1
vote
1answer
58 views

Reduce memory use for a property geolocator

I have to run a script against 40 million objects in my database: I wrote the script and I want 10 instance of it so I process my objects faster. The goal is to find all the neighborhood for each ...
3
votes
2answers
217 views

Node.js script may have memory leak

I use this node.js script to migrate MongoDB collection to a schema to another. It does work if the collection is <20k documents, but slows down to a crawl and sometime throw a FATAL ERROR: JS ...
2
votes
1answer
121 views

Loading the JDBC driver jar dynamically from external location

I have a small project in which I get the URL, username, password, and driver from a text file and I have to fire a query on the database by dynamically reading the jar file in a predefined directory, ...
5
votes
1answer
144 views

Custom Memory Allocator in C

I made this because I need to make a program that creates and destroys huge trees in gigabytes for hours or time. The default malloc/free in MinGW/GCC is too slow. ...
5
votes
4answers
805 views

Using std::unique_ptr and std::move

I'm trying out new things (on class Inproc), specifically using std::unique_ptr and ...
0
votes
1answer
47 views

Use parent class to declare a child object or how compiler allocates memory

I'm working with C# and .NET Framework 4.0 and Windows Forms. On my project I have three custom objects that inherits from MyControl class (...
6
votes
2answers
293 views

Reading, counting, and processing integers from a text file

The following code reads a .txt file that contain only numbers. Read the first one, create a dynamic array and put the other numbers on it, made some procedures and in the end write a file with the ...
12
votes
3answers
870 views

Random permutation of int[] and ArrayList<Integer>

I wrote a simple program using int[] and ArrayList<Integer> which aims to get a random permutation output between 1 to 10, ...
0
votes
0answers
65 views

Freeing a binary tree data structure in C

I have this function that I hope to be a good alternative to the recursive (thus performance expensive) approach. ...
1
vote
2answers
110 views

Deserialize JSON Strings Directly into Models?

I have Ruby models which are populated from the responses of API calls in the following way: JSON.parse converts the response to a ...
1
vote
2answers
327 views

std::vector of pointers with the rule of three

I have a class that has a std::vector of pointers, I'm NOT going to give any of those pointers to objects outside of it, I mean, I'm not going to share the ...
1
vote
2answers
79 views

Backing up an entire website with PHP

I'm attempting to backup lots of website using this php code. The script basically goes through the whole public_html directory and adds all the folders and files recursively and zips them. Here's ...
10
votes
1answer
100 views

Wrapping types with alignment requirements

Visual Studio 2013 still doesn't support the alignas keyword in C++11. This causes some problems with alignment of types in various situations. Thankfully the ...
5
votes
1answer
59 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 ...
6
votes
2answers
89 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
245 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
96 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
36 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
55 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
239 views

Implementing an ArrayList

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

RAII and code duplication in constructor/destructor

I have a class hierarchy similar to this: ...
3
votes
1answer
124 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
321 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
302 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 ...