Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [memory-management]

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.

-3
votes
0answers
16 views

Android MVP, Dagger, Memory Leaks [on hold]

I am looking at code from this repository https://github.com/frogermcs/GithubClient/tree/1bf53a2a36c8a85435e877847b987395e482ab4a specifically SplashActivity.java SplashActivity.java and ...
11
votes
2answers
961 views

malloc() and free() for Linux with system calls

I have written an implementation of malloc() and free() for Linux using the sbrk() system ...
1
vote
2answers
35 views

Lowest open space in memory

I am writing a simple compiled programming language. Everything but the bytecode interpreter can run as slow as possible, but I would like the interpreter to fun fast, because that's why I made it ...
1
vote
1answer
24 views

Reconstructing Matrix scattered over many MPI ranks

I have a program that does some matrix computations using MPI (MPICH). Each rank has a slice of the matrix and does the computations on their slice to get a new slice of the matrix. Sometimes I need ...
6
votes
1answer
60 views

Bash script to send notifications when low on ram

Backstory Recently, we've changed the PCs at my workplace to un Linux Mint. It works amazing, is blazing fast and the adjustment time was very short. However, I noticed my PC would freeze completely,...
7
votes
2answers
107 views

Fixed-sized memory pool in C

I'm learning C and I am currently implementing a memory pool. I'm writing it in steps, first I implemented a fixed-sized memory pool then I will try to implement a memory pool with a known size of ...
2
votes
0answers
87 views

Yet Another Non-Intrusive Reference Counted Smart Pointer Implementation

I needed a reference counted smart pointer for my project, and for some reason early in my project, I decided that I did not like the std::shared_ptr. I can't ...
5
votes
2answers
98 views

Object pool and sorted linked list in C

Update: Have implemented some of the suggestions: See GitHub: https://github.com/BostonBrooks/MathsGame/tree/master/Object_Pools_Demo I am implementing a game engine where I have a sorted list of ...
2
votes
0answers
76 views

Memory release after joblib.Parallel [python]

Stuck with the issue with memory consumption - after running joblib's Parallel, deleting results and gc.collect() -ing I still have increased memory (checking by htop for process line). Found no way ...
2
votes
1answer
86 views

C++ - Trie Implementation

I am trying to learn trie and this is my first implementation. I started off with the idea of being able to handle different data types for key and value; however, I found the data structure a bit ...
4
votes
1answer
143 views

Huffman Coding library implemented in C

I have written a small library for C that implements the Huffman coding algorithm as outlined in David Huffman's paper on Minimum-Redundancy Codes, and a small test program to implement it. The ...
6
votes
3answers
1k views

C# version of C++ shared_ptr

I need something akin to C++'s shared_ptr. Essentially I need an IDisposable item that I can ensure is cleaned up as soon as possible once all references have been removed, but this resource will be ...
5
votes
3answers
224 views

Python lexicon class

First time around Code Review so please be gentle (and I am happy for comments on which angles of this post are a good fit and which less so). I'm not pretty much used to software engineering in ...
3
votes
1answer
78 views

Deep-copyable unique_ptr wrapper with std::visit-like feature

I'm writing a simple wrapper for std::unique_ptr, which copies the pointed object when copied. Unlike this wrapper, it properly copies derived classes if ...
3
votes
1answer
66 views

Pre-baked Hash table with a flat memory layout

A few notes: There is currently no non exception-based way of knowing whether a key is present in the table or not. This is intentional for my use case. Unlike the lookup process, the baking process ...
3
votes
0answers
72 views

Pandas data extraction task taking too much memory. How to optimize for memory usage?

I need to process some data (one of its columns contains a json/dict with params- I need to extract those params to individual columns of their own; catch- some rows have some parameters, others have ...
5
votes
3answers
110 views

Print strings in order with dynamic arrays

I accomplished the following task to practice allocating on the heap. reading words from stdin sorting them in lexicographical order printing the sorted words To accomplish this is allocate the size ...
1
vote
0answers
28 views

Downloading, decrypting and merging of file parts

I'm trying to download multiple file parts and merge them into one file: ...
0
votes
0answers
52 views

Memory management - Large amount of data

Context I created a bundle to run asynchronous actions (using RabbitMQ) from data extracted by a service named extract_rule in the bundle context. There are some definitions from documentation : An ...
4
votes
2answers
276 views

Object pool for allocating generic objects in aligned memory

I made a single header object pool for use in personal projects. It's supposed to be easy to use, cross-platform and thread safe. It uses a free list for allocations and a hashmap for dereferencing ...
5
votes
1answer
60 views

Block Allocation in Fixed-Size Block Allocator

The following routine is the block-allocation procedure in a fixed-size allocator being written for library use. It is designed to be accessed from C++ (the un-mangled symbol name is ...
2
votes
3answers
249 views

A Stack Template

Why you're here: Today I bring you a simple Stack Machine and a Lot of questions. I am trying to gain a little bit more understanding of pointers, memory management and templates and thought a Stack ...
7
votes
2answers
169 views

Tail implementation using a dynamic queue library

As per K & R exercise 5-13 Write the program tail, which prints the last n lines of its input. By default, n is 10, say, but it can be changed by an optional argument, so that ...
4
votes
0answers
85 views

SoundBoard in C++ Using Qt

I've been working on a soundboard software for tabletop games audio immersion in C++ using Qt. The software consists of 2 tabs who provides to a game master a set of individual sounds or scenes to be ...
4
votes
2answers
167 views

Implementation of K&R Malloc

This is a one file implementation of K&R Malloc. It's passed all test cases I've run on it, so I would like to request a code review. my_malloc.c ...
1
vote
2answers
240 views

Eight Queens Recursive

I am working on a Java textbook chapter on recursion, and I am to implement an Eight Queens solution using recursion. Though I know that I am to post working code in Code Review, I do believe this ...
4
votes
0answers
81 views

Custom fixed-space block memory allocator

This is a fixed-size memory allocator. The core memory block is just a unsigned char pointer which gets allocated on initialization. Other than that has pretty basic allocation and block safety ...
10
votes
2answers
2k views

Yet another implementation of malloc() in C

I'm really curious to know someone else's opinion on this implementation. Specifically, I would be interested to know the way you would have implemented it. Here the list of issues I've found with in ...
4
votes
3answers
493 views

Doubly Linked List Implementation [C++]

C++ noob reporting. I'm working on implementing a doubly linked list using two separate classes: one class, called node, containing your standard doubly linked list ...
1
vote
1answer
144 views

HTTP download with dynamic reallocation and retries

This code is for downloading a file via winhttp lib, It's invoked by StartDownload function which tries to download n times before returning false if maximum tries ...
2
votes
2answers
76 views

Quick general purpose linked list in C

I want to use it when some function needs to return a list of something. Is it working as I think it should or is there undefined behavior somewhere? What I really tried to achieve is something like a ...
28
votes
5answers
4k views

C++ Vector Clone

I'm learning C++, so I decided to make a simpler clone of std::vector. Concerns: I have seen people defining methods outside of the class, and only prototyping ...
6
votes
1answer
712 views

Fast pool allocator for games in C++

I have implemented the following pool allocator in C++: ...
5
votes
2answers
117 views

Overriding operator delete/new to check correct pairs of (non-)array variants

A legacy project I am maintaining in my freetime uses overrides of operator delete / operator new. These overrides over-allocate ...
3
votes
0answers
218 views

C++ object pool using C memory pool as base

I started out with this question on Stack Overflow. I have since then gotten an official answer from the mbed developers that the MemoryPool that I was asking about only issued raw C malloc/free type ...
9
votes
4answers
1k views

Populating a structure

I'm solving K&R exercise 1-13: Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation ...
3
votes
1answer
152 views

Fixed-Size Memory Pool with alignment

After taking a break and reviewing the comments on my first attempt at creating a fixed-size memory pool, this is my second attempt. The memory pool should allocate each block correctly aligned in ...
3
votes
1answer
121 views

A free-standing weak_ptr equivalent to handle lifetime of non-shared callback objects

I've been finding myself wanting the following pattern recently: ...
3
votes
1answer
88 views

Stack allocator and C11's alignment features

I am trying to write a custom stack allocator for a game I am working on. To deal with memory alignment, I am using C11's stdalign.h header; however, since I do not ...
1
vote
0answers
69 views

Excel vba: setting a long variable for each object class dramatically increases execution time

I have a main sub that makes use of a Client class: creates an array with 100 000 Clients ...
1
vote
0answers
20 views

ManuallyCompletableOperation for OperationQueue

Here is a very handy subclass of Operation that allows to do asynchronous tasks inside an OperationQueue: ...
2
votes
1answer
365 views

dqueue - A dynamic FIFO queue library for C

This is the first draft of dqueue, a dynamic queue library written in C, with a sample program to demonstrate it. This is my first time writing any sort of library to be used as a generic subsection ...
-1
votes
3answers
81 views

Populate array with random numbers efficiently

I have an initial Excel workbook with about 100 000 rows. I put those rows into array and then use that array to create Client ...
12
votes
2answers
1k views

Weapon and Hero classes

For me as a complete newbie to the world of C++, getters and setters are a rather confusing topic. There seems to be a wide range of opinions on what constitutes a sound use of getters and setters. In ...
2
votes
1answer
79 views

Private storage for at-rest data in VBA

One major annoyance in VBA programming is that it's hard to keep a secret secret. In this particular case, it's the ADODB.Connection. For reasons not germane to the ...
0
votes
1answer
328 views

Implement a working Vending machine [closed]

Task: Design a vending machine which does the following: Accepts coins of 1, 5, 10, 25, 50 cents or notes of 1 and 2 User selections: Candy, snacks, nuts, Coke, Pepsi and soda ...
1
vote
0answers
91 views

Memory leak in pixel reading class, Gdk::Pixbuf::create

I am trying to teach the Google Chrome dinosaur (the one that appears when you have no Internet connectivity) how to avoid obstacles. For this, I have written a genetic algorithm to select the fittest ...
1
vote
1answer
460 views

C Implementation of dynamic mem allocation using first-fit algo

I have implemented malloc and free in C based on first-fit algo and using a circular linked list for free blocks of memory. It seems to be working based on the basic test in the main function. I would ...
2
votes
3answers
1k views

Memory allocation for linked list in C

I am new to C and am writing a basic program to calculate the arithmetic sum of two numbers stored in a linked list. My main question is idiomatic memory management in C. The program below allocates ...
-3
votes
1answer
5k views

Memory error in python [closed]

I am writing a code which returns something like 1^k + 2^k + 3^k......n-1 where k be any number.Below is my code.I am getting a memory error.How do I optimise it. Sample test case for wrong error: 1 ...