Questions tagged [memory-management]

Process of dynamically allocating and freeing portions of physical memory in order to respond to program requests with, if possible, fairness and no starvation among the requesters.

Filter by
Sorted by
Tagged with
2 votes
1 answer
33 views

Why empty struct use no memory ? And why empty struct will use memory when it as a filed of a struct that has other fields?

I have two questions that make me confused. Why empty struct use no memory? If a := struct{}{}, the variable a how to be stored in the stack. When empty struct as a field of a struct, it will use ...
AquaOwO's user avatar
  • 29
-2 votes
0 answers
55 views

An Efficient way for Data Processing Locally

I am trying to solve a problem using local computer resource, an i5 CPU, with 8G of ram and non SSD hard disks. The problem is I want to parse millions of folders, aka items containing XML files from ...
Arunavo's user avatar
  • 30
1 vote
2 answers
64 views

What is the difference between these two implementations of push_front function for dynamically allocated array? (malloc vs realloc)

Can you explain why exactly the first function doesn't work correctly? I wrote two identical functions: bool push_front(int value, size_t *size, int **arr) { if (!*arr) return false; int *...
krotovukha's user avatar
0 votes
0 answers
21 views

Why does memory consumption in python do not return to as it was when file is read and data is no longer being used

I have a code that reads a file, and then immediately deletes the read data. However the memory consumption of process before reading the data and after the data has been read and deleted do not match....
Saksham Ghimire's user avatar
-1 votes
0 answers
10 views

Unity memory profiler shoes 23% difference between snapshots however fails to show where it comes from

I'm trying to optimize the memory usage and I used the memory optimizer. There is a vast difference between snapshots (23% total) however all under detailed tables, all changes are minor. Here is the ...
user2102266's user avatar
0 votes
1 answer
26 views

Parallel reductions with complex objects

Typically (from what I can tell) reduction operations produce a "number". This makes them easy to deal with since there isn't really any memory overhead. However, I have something that I'm ...
user2978125's user avatar
-1 votes
1 answer
52 views

How to free the memory of one element in a HashSet?

If I had a code like this: public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); //an integer ...
Rook's user avatar
  • 9
1 vote
0 answers
108 views

Issue with the initialization of a large, dynamically allocated array

I have two versions of the same Fortran code: Version 1 (static allocation): program main implicit none integer,parameter :: n=1000000 integer,parameter :: m=10000 real(8) a(n,m) a=0.d0 ...
Roland Tóbiás's user avatar
0 votes
0 answers
10 views

How to change the batch size of pcp in linux kernel? [closed]

I increased the pcp->high via echo 8 > /proc/sys/vm/percpu_pagelist_fraction command, but the pcp->batch value still remains at 63. vm stats threshold: 125 cpu: 383 count: 103931 ...
Frontier_Setter's user avatar
-1 votes
0 answers
25 views

IDE runs of memory while using jupyter notebooks

I am using PyCharm to work with jupyter notebooks. My IDE is giving a warning saying that it is running out of memory and recommending I increase the heap size. My project has multiple .ipyb files but ...
mais's user avatar
  • 1
0 votes
0 answers
58 views

Destructor of a class is not called when the object gets erased from a list

I'm trying to remove an object from a list inside a class but when the erase function is called the destructor of that class is not called. This is the code of my function: void AsteroidSpawner::...
Allennick's user avatar
  • 447
0 votes
0 answers
23 views

Memory performance improvement for downloading images for a large dataset

I am currently making a program that fetches movie/series details from a url and decodes them into a ContentModel, then tries to download the image for each posterURL in the model and then returns it: ...
Yousif Ismat's user avatar
-2 votes
1 answer
53 views

C++ - Segmentation fault when trying to insert a char* to a string vector, depending on length of string [closed]

Edit: This is being done with the GCC 11.2 compiler My program is a lot more complicated than below, but I've managed to isolate the problem in my code to this issue. Basically, I need to construct a ...
Zuhaib Ahmed's user avatar
-3 votes
0 answers
70 views

C++ a unique_ptr with multiple values over the time. Which option is more efficient to change the value: reset() or operator=make_unique? [closed]

I have this scenario in which I parse a lot of files. Each file is parse by a Parser which takes a path to that file. I would like to ask about the change of the pointer's value. I have these two ...
JacobJ's user avatar
  • 1
2 votes
2 answers
90 views

C++ placement new and inheritance

Background: I am using C++ 20 I am using shmget/shmat to create a big chunck of shared memory. Inside this shared memory, I initialize a dlmalloc instance, allowing multiple processes to allocate and ...
mewais's user avatar
  • 1,307
0 votes
2 answers
70 views

When is having a mutable and an immutable reference at the same time really a problem?

I've been playing around with Rust for some time now. It's hard, it's new, it's exciting, and the compiler is very helpful. So I usually end up with working code. But there is one problem I quite ...
NoBullsh1t's user avatar
1 vote
0 answers
66 views

In Qt, why does setting the style sheet of a QPushButton increases my memory allocation permanently?

I am using Visual Studio 2022, the latest ISOs for C and C++, and Qt. I have the header files and the library files linked against my solution (.lib files are linked to the solution and the .dll files ...
Christopher Barrios Agosto's user avatar
0 votes
0 answers
10 views

Birt Report strange response time behaviour

I am using Birt Report to generate transactional reports in PDF format. Currently, the service receives approximately 50 requests per minute. The problem is that over time, the response times and PDF ...
dssof's user avatar
  • 87
0 votes
1 answer
41 views

Pytorch: torch.cuda.memory_allocated() returns 0 if PYTORCH_NO_CUDA_MEMORY_CACHING=1

There are clearly tensors allocated in my GPU memory. When I turn PYTORCH_NO_CUDA_MEMORY_CACHING enviroment variable back to 0 it works seemingly fine. Is this a bug? I've read pytorch documentation ...
harsanyidani's user avatar
0 votes
1 answer
88 views

What pointer type to use, when I do not know the context the pointer are used

I am developing a library, so I do not know the context of the application, that will later use the library. I have two classes. The Window class registers Widgets, so it can eg. forward ui events to ...
steffen's user avatar
0 votes
4 answers
74 views

Moving all the contents of one vector into a new vector

To make a new vector with the content of an old vector (which I want to be emptied) I'm going to use: foo.bar = my_vector.drain(0..).collect(); Is this idiomatic Rust? Is the drain() optimised away, ...
fadedbee's user avatar
  • 42.8k
1 vote
1 answer
29 views

MsCorLib Array.cs Array.Sort line of code that not compile

in th MsCorLib Array.cs source file there is the following Method, at line 1941: void Sort<T>(T[] array) in the body block at line 1948 there is the followin line var span = new Span<T>(...
Marco Levarato's user avatar
0 votes
1 answer
27 views

Memory issue in machine learning project tensorflow.keras

The problem occurs after the first batch of 150 training images is processed. The model begins processing the next training batch, prints 1-3 images from it (for debugging), and then the RAM usage ...
Angelina Mkrtchyan's user avatar
0 votes
0 answers
16 views

Gitlab SAST/DAST configuration for memory leaks

I have a repository that contains C and CPP Android NDK code that I would like to do SCA analysis on to determine whether there are memory leaks in the modules. I have ran HWASAN and ASAN scans on the ...
ANSOLO's user avatar
  • 35
0 votes
0 answers
17 views

how can I manage memory in librdkafka?

I am developing a high-performance program that is a librdkafka producer. I want to manage the memory of librdkafka so that I know the status of the memory of the software. to do this I defined a free ...
hpirlo's user avatar
  • 123
0 votes
1 answer
52 views

How to control unstable memory usage in C#

My project is about data receiving in milliseconds or nanoseconds in WPF and C#. The data I receive varies as double and long, and my arrays can reach up to 1 million points. My memory problem becomes ...
MLHYLMZ's user avatar
  • 33
0 votes
0 answers
52 views

Can you share heap memory between two processes? (Rust and Node)

I am designing a program that is written in Rust but allows for configuration to be supplied by the end user in the form of JavaScript code. At the moment, I am thinking of having the Rust application ...
David Alsh's user avatar
  • 6,767
0 votes
0 answers
16 views

How to flush/invalidate cache entries pointing to kernel space memory addresses allocated with kmalloc

I' developing a DMA driver for Linux/AMD64. For this purpose I need to flush and invalidate any entry in the CPU cache memories referencing addresses in memory buffers allocated with kmalloc. I ...
EajksEajks's user avatar
-2 votes
0 answers
49 views

Cuda issues with creating texture memory object

I want to optimise my program by simply transfering a constant array of values that are being compared to the texture memory. It is a 1D array. I tried this example https://saturncloud.io/blog/texture-...
imNotARobot's user avatar
0 votes
0 answers
21 views

gamm4 output size is too large (~5GB). How to decrease?

I am running a Generalized Additive Mixed Model with the R package, gamm4. Each model output includes a mer object and a gam object. I need to compare 26 model structures based on a combination of ...
megsruppUNBC's user avatar
3 votes
1 answer
172 views

GPU ran out of memory. How to invoke garbage collector for cleaning the GPU memory at each combination of hyperparameters using GridSearchCV?

I am training my model on a remote server using GridSearchCV API for tuning some hyper parameters such as epochs, l_rate, batch_size and patience. Unfortunately while tuning them, after few iterations,...
tail's user avatar
  • 327
2 votes
2 answers
84 views

How does singleton instance implementation in C++ does not leak memory?

I'm studying about singletons in design patterns and I saw this singleton implementation and I tested it with fsanitize=address, because there is no delete keyword even though there is a new keyword ...
himynameisjm's user avatar
1 vote
1 answer
56 views

What are the benefits of flattening the 3-D array to 1-D array?

I have a 3-D array represented in Java as int[][][] arr = new int[X][Y][z] If I try to implement the 3-D array using 1-D as int[] oneDArray = new int[X*Y*Z] index of an element arr[i][j][k] in 1-D ...
shivakumar's user avatar
1 vote
1 answer
70 views

How can I implement the Rule of Three for Vulkan Objects?

I would like to create simple vectors of shaders, pipelines, textures, and other objects used with the Vulkan API, but I am struggling with understanding how to use copy-constructors, move-...
ModernEraCaveman's user avatar
0 votes
0 answers
29 views

How to properly clean the memory usage in Python code

I'm really curious about this behavior. I've the following python code that I'm running in a server and I'm monitoring the memory usage meter # import some libraries # Memory Usage: 310 MB spark = ...
jbds's user avatar
  • 1
0 votes
2 answers
48 views

Why is the use of a stack, manipulated by both a stack pointer and a base pointer, the proper solution to handle function frames?

Can anyone enlighten us from both technical & historical perspective why computers use a stack, manipulated with a stack pointer and a base pointer, with a specific process to follow like saving ...
bwass31's user avatar
  • 75
0 votes
0 answers
13 views

VmRss for a process is growing linearly and not stabilizing. Can it be a memory leak?

So I have a alma OS 64-bit linux based application. My application has various process out of which one of them, let's call it "VoicemailApp" is showing linear increase in VmRss over a ...
Srushtea's user avatar
0 votes
1 answer
54 views

Memory saving working with pointers in Go

I would ask if there are some benefits declaring a pointer in reference types (slices, maps, channels, pointers & functions). For example: package main import ( "fmt" ) func main() ...
zidk's user avatar
  • 27
-2 votes
1 answer
20 views

Which object takes up more memory space and why: [1] or [1,1]?

Let's assume I have two list in Python: a = [1] and b = [1,1] (the language is irrelevant, as well as the object inside the lists). My question is: which of them takes up more memory space, and why? ...
invalid syntax's user avatar
1 vote
1 answer
53 views

How to calculate the position that the parameters should be pushed to when we use Windows x64 memory management by x64 assembly

I was confused by some of the x64 assembly codes used for memory management, such as CreateFileA, WriteFile, and ReadFile. Whey creating a file by using WriteFile, they defined a couple of positions ...
Daniel's user avatar
  • 11
-3 votes
1 answer
69 views

C++ program outputs memory address but only when used as a function

#include <iostream> using namespace std; int numericMenu(); void newGrade(int*, int); int main() { int choice = 0; int* gradePtr = nullptr; int size = 0; int i = 0; gradePtr = new ...
EpsilonSeven's user avatar
0 votes
1 answer
39 views

What is the "struct address_space" that backs a anonymous memory page?

In the Linux kernel, there is a field named mapping in struct page. This field may represent the file that backs the page when it's the buffer cache of the file. It could also be a page that is backed ...
Lingfeng Xiang's user avatar
0 votes
1 answer
66 views

Having a static class inside Non-static class. How does the memory management happen? [duplicate]

If you have a static class inside a non static class, how does the memory management happen? public class test { public static class stringVariables { // inline code } // inline ...
Hanish Goel's user avatar
2 votes
1 answer
57 views

How much memory does a single, cloned git repo occupy? [closed]

After using git for version control purely on my remote server, I am now looking to use git for version control across both my remote and local file system. My approach to doing this so far is to: ...
user10709800's user avatar
1 vote
1 answer
76 views

how the local variable are stored and returned in memory (python)?

I always used python without thinking its memory management. But, I have a big question about how it deals memory. def func1(): local_var = 1 print(id(local_var)) # memory address of ...
live-today's user avatar
0 votes
2 answers
64 views

Does it make any difference when aligning a struct with 32 or 64 when its size is in between 32 and 64?

#[repr(align(32))] struct Data { array: [f64; 6], } fn main() { println!("size of Data: {}", std::mem::size_of::<Data>()); } Without aligning keyword (#[repr(align(32))]), ...
Rahn's user avatar
  • 4,783
0 votes
0 answers
22 views

Unsustainable memory consumption in Codon compiler for Python

I was working with real-world data with a couple hundred million rows. Since Python took ages to go through them, I decided to experiment using Codon for faster execution. It worked well with smaller ...
user3650176's user avatar
0 votes
1 answer
40 views

What does Total Allocation mean in the JFR result as viewed in JDK Mission Control?

Im having a weird scenario where Im attempting to determine the root cause for some process restarts. We collected JFR for a period and I see that the heap does not grow over time. The maximum size of ...
Mkl Rjv's user avatar
  • 6,765
-1 votes
0 answers
33 views

Understanding the difference between including and excluding libraries in Rust [duplicate]

Currently learning Rust and more about the memory saves, efficiency, and optimization principles that accompany it. I read through the prelude documentation and in the second paragraph, it makes a ...
MUFF.'s user avatar
  • 338
0 votes
0 answers
53 views

How to dispose an unmanaged resource/object that doesn't implement IDisposable

Actually question is simple but I wanted to provide as much information as possible to help everyone to understand problem/issue. For this reason question may seem long/hard. My question is briefly: ...
livan3li's user avatar
  • 129

1
2 3 4 5
547