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)

2
votes
0answers
77 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 ...
6
votes
1answer
289 views

Optimizing variable order Markov Chain Implementation

I've created a variable order Markov chain built on top of a tree, but I can't train on datasets >1MB worth of text without running out of memory. I'm sure the tree can be replaced by something else ...
7
votes
3answers
2k 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. ...
6
votes
1answer
60 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
150 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 ...
2
votes
3answers
91 views

Creating lightning bolt effects

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

Min Heap implementation with Dijkstra's algorithm

I am implementing Dijkstra's Algorithm using Min Heap to speed up the code. For a small number of nodes, the code is really running very fast. But for a large number of nodes, my code is throwing ...
4
votes
1answer
57 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: ...
3
votes
1answer
68 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 ...
8
votes
3answers
1k 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 ...
3
votes
0answers
175 views

Parsing and producing sets of financial CSV files

I have this small Haskell script that I wrote some time ago to parse a set of financial CSV files to produce other CSV files. I've recently had a problem with large input files (around 300Mb) that I ...
6
votes
0answers
53 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 ...
3
votes
1answer
54 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
1answer
510 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 ...
4
votes
0answers
99 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
34 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), ...
0
votes
0answers
153 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 ...
3
votes
1answer
32 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
93 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. ...
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. ...
8
votes
1answer
105 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 ...
17
votes
1answer
279 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: ...
8
votes
2answers
111 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 ...
4
votes
2answers
2k views

Allocating memory for a matrix with a single malloc

For an interview, I was asked to write code allocate memory for a rows*cols matrix, using a single malloc(). I want your comments about this code that I wrote: ...
4
votes
2answers
104 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 ...
7
votes
1answer
4k 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.) ...
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. ...
6
votes
1answer
849 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 ...
10
votes
1answer
102 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
2answers
456 views

Human (imperfect) array (card) shuffle written in C

I've got this humanoid_shuffle I wrote in Python. I've been wanting to learn C so as an exercise I ported it to C. As this is my first venture into C and even the ...
8
votes
4answers
267 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 ...
6
votes
2answers
74 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 ...
3
votes
1answer
58 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, ...
2
votes
1answer
129 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, ...
3
votes
3answers
99 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 ...
5
votes
2answers
166 views
8
votes
1answer
91 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? ...
1
vote
2answers
121 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 ...
3
votes
1answer
144 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 ...
4
votes
1answer
141 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
60 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 ...
4
votes
2answers
486 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 single text. Then I need to use the cosine similarity: $$similarity = cos(\theta) = \dfrac{A \cdot ...
3
votes
2answers
279 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 ...
6
votes
2answers
304 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 ...
5
votes
1answer
179 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
1k views

Using std::unique_ptr and std::move

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

Dynamically allocated C strings in C++, concatenation, pointers, etc

I'm writing a small Win32 console app that manipulates the contents of binary files. It accepts the filename as a command line parameter and writes to a file named filename.scramble This is the first ...
1
vote
1answer
861 views

Memory leaks in lottery simulator

I'm primarily a C++/Java programmer, but I've recently started using Python at work and decided to write a Lottery Simulator at home. I wrote it to test out different combinations of lottery numbers ...
0
votes
1answer
49 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 (...