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)

4
votes
1answer
35 views

YAGOP - Yet Another Generic Object Pool

While thinking about this question it struck me that one problem of linked data structures always seems to be loss of memory locality and performance could possibly be improved if all allocated nodes ...
0
votes
0answers
28 views

Memory management in Python with thousands of sequential instantiations [closed]

Given a spreadsheet of a few thousand URLs, I will loop over them and for each, instantiate a Page() class then call two methods, the first to get the page, the ...
1
vote
0answers
26 views

Purging elements from the map if it reaches a memory size limit

I have implemented a LRU cache using ConcurrentLinkedHashMap. In the same map, I am purging events if my map reaches a particular limit as shown below. I have a ...
1
vote
0answers
56 views

C++ base class for heap awareness

I have a few classes that form a class hierarchy where some objects point to others. In the usual case, I create these object on the stack. In other cases, I need to clone these object to do some ...
3
votes
1answer
40 views

Singly linked list in pure C - follow-up

This is an update for this post. I fixed all style-issues from the comments, but still have a few questions left: Someone commented that my last post contained too many functions, which could be ...
2
votes
3answers
56 views

Singly Linked List in pure C

I recently learned about linked lists and here is my first try to write one in C. I know it's a lot of code, but I hope someone takes a look. Any tips memory allocation and improvements are welcome. ...
8
votes
3answers
281 views

Implementing IDisposable

I am developing a class (in a C# MVC 5 project) that originally had a using block within a single method, and it got to be very huge after placing formatting ...
3
votes
2answers
90 views

Memory leak in Java's stack implementation

Recently I was asked to implement a stack specifically for storing 'int' type data and find memory leaks. Isn't the garbage collector responsible for releasing all the memory? What are the possible ...
6
votes
5answers
814 views

Memory-safe file-reading in C

I am trying to write a single function that will read a certain number of bytes from a C file, or the entire file, based on the arguments. I want it to be memory-safe of course, and deal with ...
7
votes
1answer
108 views

A function for block allocation

During Jonathan Blow's video where he muses about a games-focused programming language, he presents C++ code that allocates a single big block of memory and has N pointers into that block. The purpose ...
1
vote
1answer
59 views

jQuery Responsive Carousel

I have developed a jQuery Responsive Carousel. When opened, the carousel in the browser and the Chrome task manager, I see that the memory usage of my page is higher than the rest of the opened tabs ...
7
votes
3answers
82 views

Type-agnostic BubbleSort in C

I'm trying out different sorting algorithms for learning purposes, here I'm doing a "type-agnostic" BubbleSort. I modeled the function signature after the standart ...
4
votes
2answers
120 views

Does my Linklist implementation have memory leaks?

Are there any memory leaks in this linklist implementation.Also is the implementation correct?Can the time complexity be optimized? ...
6
votes
2answers
110 views

Fixed-Size Memory Pool

I've been reading about Memory Pools since I came across them in the book Game Programming Complete 4th Edition, and I decided to try and spin my own since I didn't quite understand how the one they ...
10
votes
3answers
390 views

Stack implementation with move semantics

I have implemented a basic stack just for fun. I've just started learning about move constructors and assignment and move semantics as a whole, so I would really appreciate some feedback as to whether ...
4
votes
1answer
67 views

Iterative Red-Black Tree (dynamic stack)

I've completely reworked the previous code, posted here, so that it is a bit more correct regarding dynamic memory management, and also a bit more true to the object-oriented paradigm. ...
4
votes
2answers
140 views

Memory management for Red-Black Tree

I've written this program yesterday, and I was reminded why I dreaded C++ before turning to Java: pointers and associated terms (like destructors, initializations and copy/move constructors) are ...
6
votes
1answer
142 views

Unity3D native iOS plug-in to read pedometer data

I've made a plug-in for Unity3d for iOS. The plug-in's job is to get the Pedometer data from history within a specified period of time and return that to Unity for later use. I am confident in my C# ...
1
vote
1answer
85 views

Manage process in C++

I made a fast and simple WPM (WriteProcessMemory) for Android. Any suggestion is welcome. ...
3
votes
0answers
96 views

Specialty tree structure - BK Tree

I've been working on a implementation of specialty tree structure called a BK-Tree (more here and here). Basically, it's a tree that allows relatively efficient querying for items within a specific ...
9
votes
3answers
280 views

Garbage collection in JavaScript multiplayer game

I am currently creating a Multiplayer Game using node.js and web sockets. The client side is receiving the positional information and applying it to all the players on the client side. Each client ...
3
votes
0answers
65 views

Pulling data from API, Allowed memory exhausted

I'm working on a project where I pull data (JSON) from an API. I would like to manipulate this data and store this as useful information in my DB (MySQL). My code is working if I would like to make, ...
4
votes
1answer
99 views

Allocating matrices for in-place modification

This code seems to be working. I am allocating matrices on the stack and passing them to functions to modify in place. Is this a standard practice, or am I doing it wrong? Header: ...
6
votes
2answers
221 views

Converting a SecureString to a byte array

Does it allocates something that hasn't freed? Something that remains in memory? Except result byte array, ofc. ...
5
votes
1answer
44 views

ADT stack with a dynamic array (revision 1)

Here's the second draft of my ADT stack code which I posted here before after carrying out most of the improvements suggested there. I decided to expose a function called ...
5
votes
4answers
172 views

ADT stack with a dynamic array

I'm starting to learn about data structures and coding in C. The stack is the simplest of all data structures so I'm trying to implement an ADT stack with dynamically allocated array in C. This ...
2
votes
1answer
33 views

Periodically resizing large array

I have a simple socket.io server written in node. Everything is working just fine, however I am curious whether what I am doing is acceptable. I am especially interested in this line ...
1
vote
0answers
85 views

Implementation of a lock-free fixed-sized allocator - follow-up - with commented code

The following implementation of a lock-free fixed-size allocator is a follow-up of: Implementation of a lock-free fixed-sized allocator §1 - Introduction The purpose is self-learning of atomic ...
1
vote
0answers
67 views

C++ and OpenCV memory management

I'm including all of my code, however, my major issue here is about returning the vector/array/pointer (I don't really know what to choose) in this function: ...
10
votes
2answers
284 views

Implementation of a lock-free fixed-sized allocator

This question now has a follow-up: Implementation of a lock-free fixed-sized allocator - follow-up I've tried implementing a lock-free fixed-size allocator while trying to learn synchronization ...
4
votes
1answer
128 views

Re-implementing memcpy

I have written an implementation of memcpy function and I want to know how good is it and if it gets the most out of the processor capabilities or not. The reason ...
2
votes
1answer
48 views

Performance improvement on vb.net code

I need to write 5 crores records with 72 columns into text file, the file size is growing as 9.7gb . I need to check each and every columm length need to format as according to the length as defined ...
3
votes
0answers
71 views

Cache with timeout per key

I wrote a general purpose library for in-memory cache with custom timeout for each key. ...
4
votes
2answers
85 views

Vigenère cipher 2

The following program is an updated version of this question, an implementation of the Vigenere cipher in C. It has been updated to take input from stdin and pipes, ...
4
votes
1answer
1k views

Vigenère cipher in C

For my second major project in C, I decided to write an implementation of the Vigenère cipher in C. My program uses command line options (optarg) and can read from both a file or from a string ...
4
votes
3answers
459 views

Creating number pattern (triangle numbers) in C++ with minimum loops

We were asked to make a triangular number pattern in C++ with minimum loops: ____1_____ ___2__3____ __4__5__6__ 7__8__9__10 Code: ...
3
votes
3answers
122 views

Drawing superellipses

Here is a piece of code that draws superellipses: ...
4
votes
2answers
317 views

C++ Int Array/Vector Over 100 Million

Textbook style program that generates the values of two, six-sided dice; which are used to perform simple calculations. Recently, I saw an example using similar criteria that was able to utilize ...
2
votes
0answers
51 views

Platform independent leak/cyclic dependency detection of objects

Sometime back I came across a bug where a particular object was leaking but it was very hard to identify the root cause. I knew that it was due to a cyclic dependency (which usually indicates a bug in ...
-1
votes
1answer
124 views

C++ linked list with too many pointers

Can someone tell me how I can improve this code? It works ok, but I feel that I'm using too many pointers. ...
0
votes
1answer
121 views

Refactor C# unsafe method [closed]

I have the following two unsafe methods that I would like to refactor: ...
4
votes
1answer
54 views
3
votes
2answers
47 views

MallocRaii implementation

I'm playing around with RAII a bit lately and I wan't to know if/how I can improve this (quite simple but very helpful) class. A word to two decisions I've made and why: No error handling in ...
7
votes
1answer
437 views

Freeing shared memory with a signal handler

I have a homework question that asks me to get 2 integers from the user, put them in shared memory, fork a child, have the child add them and put the result in shared memory, and then the child will ...
7
votes
4answers
241 views

Matrix struct with random values allocation and deallocation

I've written this code in 2013 or 2014, I think. I've rediscovered it today in one of my folders, made some changes and now I'm left (and my 2013/2014 me as well) wondering how good it looks for other ...
5
votes
4answers
445 views

Implementation of C linked list (Queue) of C strings on mega AVR

I have been working on a mechanism to queue up strings coming into a system via a USART and have implemented it as a singly linked list. I have done my best to profile the code and its memory usage at ...
3
votes
2answers
78 views

Image processing routines for an image de-noising program

I have written a multi-language software to implement an image denoising algorithm (composed of many sub algorithms) called CANDLE. I have a C program that is part of the software and would like to ...
6
votes
1answer
83 views

Pool allocator for a scripting language parser

At the moment I'm writing a parser and interpreter for a custom scripting language, to learn more about the basic concepts involved and to get more familiar with tools like ...
4
votes
1answer
286 views

Hashing a SecureString using Cryptography Next Generation

Goal: I needed to calculate the salted hash of a password, where the password is stored as a SecureString. There doesn't seem to be much .NET framework support for SecureString. In particular, none ...