Questions tagged [memory-management]

12458 questions
1

votes
1

answer
250

Views

Can I just use fixed arrays instead of memory pools?

Instead of making a memory pool system,can't I just allocate huge arrays for each object at the start of the application and just use them and in the extreme case some object does need more instances than it's array,the array will just get doubled or quadrupled in size,so it would never reach the ma...
user1779802
1

votes
0

answer
29

Views

Why Loading Images takes so much memory even though their sizes are 2KB

I have 5-6 PNG images each 2kb in size, and when i load them to my ImageView's, on Android Monitor it shows 12 MB more added to allocated memory. i don't know what other factors are there that takes so much memory. while i see other applications that are using many images per screen, they have no is...
garetHollamdaf
1

votes
0

answer
39

Views

MySQL: Retrieve millions of rows from multiple shards at the same time

We have 2 MySQL DBs(both tables in 16 shards) with 100M+ rows and growing/updating. For reporting purposes, I need to fetch all the rows(50M+) on a daily basis, from 1st DB I need to fetch all the rows(50M+) created on that day, from 2nd DB These rows might update/insertion can happen anytime. Requ...
Pankaj Singhal
1

votes
0

answer
142

Views

Crash when destroying weak_ptr, double destruction of weak_ptr's shared_ptr_emplace object

I'm running into a crash occasionally when the destructor of a weak_ptr is called. This is the precise crash log tests(35405,0x700002602000) malloc: *** error for object 0x7fcd2010a5b0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug The pointer that it is...
Kartik Aiyer
1

votes
0

answer
62

Views

Use 2 malloc calls to define 1 array c

I am trying to make an unsigned char array in c++ that is ~ 4 gigabytes in size. The code I am using to malloc the space for the array is below: unsigned char *myArray= (unsigned char*)malloc(sizeof(char)*3774873600); if(myArray==NULL) { cout
YAHsaves
1

votes
0

answer
165

Views

invalid explicit template argument(s) xmemory()

The aforementioned error (C2770) has poped up for xmemory() file along with others like Error C2825 '_Ty': must be a class or namespace when followed by '::'. I have found some questions here and there about such error but none regarding xmemory() especially that I can't edit it... The error ar...
Peet
1

votes
1

answer
74

Views

Getting valgrind error in C code

I am running memory analysis using Valgrind on C code of the small application, that finds out all paths in a graph using DFS method. But I am still getting some errors, mainly in this part of code: int process_edges(VoidStack *edges, char *buffer) { char weight[DATE_LENGTH] = ''; char min_weight[DA...
awarus
1

votes
1

answer
115

Views

concatenate or vstack numpy arrays doubling memory

Some previous information I have the following method which loads two data sets from disk then combines them and returns the combined data set. def _get_data(self, data_set_name): training_data = DataSet.from_file('path_to_data_file','path_to_label_file') test_data = DataSet.from_file('path_to_data_...
Yannic Klem
1

votes
0

answer
15

Views

How to generate/find TPC workloads traces

I'm trying to evaluate a particular cache design on my own simulator. I need traces of read and write operations. I found out that TPC workloads are memory stressful and I'd like to use them for my design evaluation. I was wondering if the traces are available or I need to run them on particular sys...
samira
1

votes
1

answer
24

Views

Are there disadvantages of using __slots__?

I'm using Python 3.7 and Django. I was reading about '_slots__' -- http://book.pythontips.com/en/latest/slots__magic.html . Evidently, _slots can be used to optimize memory allocation for a large number of those objects by doing this ... class MyClass(object): __slots__ = ['name', 'identifier'] de...
Dave
1

votes
1

answer
49

Views

one physical page allocated when malloc() called

I was trying to find the virtual set size and resident set size of a c program. I wrote a kernel module to traverse the vm_areas and calculated vss and rss. I also wrote one c program to validate the changes in vss and rss. // sample test program #include #include #include #define N 10000000 int...
Debashish
1

votes
0

answer
71

Views

Better performance with Flink Gelly when decreasing available memory

I notice strange behavior in the performance of Flink Gelly (PageRank algorithm on a graph of approximately 17,000,000 vertices and 136,000,000 edges). While setting taskmanager.heap.mb: 125000 results to a runtime of ~110 sec, taskmanager.heap.mb: 10000 reduces the runtime by more than 50%. I unde...
rawrintheclouds
1

votes
0

answer
249

Views

Android Profiler shows others section taking a lot of memory than expected

I ran Android Profiler on my App since it was slow in simple user interactions. When I ran the profiler it showed 150 mib memory used by 'others' category. After searching on official forums here: https://developer.android.com/studio/profile/memory-profiler.html It says ' Memory used by your app tha...
Suyash Gupta
1

votes
0

answer
56

Views

Track memory-consumption of a part of a program for caching

I´m looking for an approach to keep track of memory-consumption from a part of my program. What I´m trying to achieve in the actual use-case is to write a cache-class with an upper size limit. Since the cached data is a rather complex hierarchy of some nested classes adding a getSize() methods to...
J. Mueller
1

votes
0

answer
23

Views

Stack allocation fail when close to heap

Issue Description C++ server got several crashes at the same stack frame as below enter image description here Investigation Memory was not used up, 400M-800M Stack space used is not large, about 270K-350K Haven't found any other code issue caused crash The distance between stack and heap is about 1...
oliver zhu
1

votes
0

answer
207

Views

Why does LibreOffice wants memory pages to be writable and executable in the same time?

OpenBSD has great features for Memory protection, ex.: W^X. https://en.wikipedia.org/wiki/W^X https://man.openbsd.org/mount We can disable this function with the 'wxallowed' mount option if a program needs it, and sadly, LibreOffice needs the wxallowed on /usr/local/. The Question: Can someone Ple...
Hessnov
1

votes
0

answer
259

Views

Monitor Spark execution and storage memory utilization

I know there are several ways to monitor storage memory utilization of a Spark application but does anyone know a way to monitor execution memory utilization. I am also looking for a way to monitor the 'user memory', that is memory that is not used for execution nor storage memory. Going by Spark's...
Antonio Ye
1

votes
1

answer
57

Views

Gem 5 Memory Allocation

I have made an x86 architecture on gem5. Now if we run an executable file with a memory allocation code using malloc then will this memory be allocated from my system or a virtual memory given to this x86 architecture.
Prakhar Gurawa
1

votes
1

answer
150

Views

Valgrind finding memory leak for string even after I free it

In my program I declare some nodes in a linked list: node_t* newSymbol = malloc(sizeof(node_t)); newSymbol->symbol.name = strdup(name); //name is a (const) char* that is a parameter to function I'm in. newSymbol->symbol.addr = addr; I use strdup because assigning the symbols name to the parameter di...
Bonfire184
1

votes
1

answer
511

Views

What is kernel dynamic memory in linux systems and how to free it

This question is related to https://serverfault.com/questions/896282/cannot-explain-memory-occupancy-in-linux/896525#896525 and to How to correctly identify and correct a memory leak on a server? What is kernel dynamic memory? I have virtually no process running in my workstation now $ ps aux --sor...
mox
1

votes
1

answer
1k

Views

React Native iOS app using large amount of memory

I'm building my first react native ios app. The main feature of this app is to make a request to a server, get data and render that in a FlatList. On initial load, 15 list items inside the FlatList are rendered, and when the user scrolls down, 15 more are added each time the user gets to the bottom...
Luka Kerr
1

votes
1

answer
49

Views

C, garbage/junk values in string when reading textfile

I'm trying to read in a .txt file (paragraph.txt as input) in C, and when I print the string it has garbage values on the end such as the paths to my visual studio, or junk data. This occurs 99% of the time with some exceptions. I have no idea why it is doing this? void readfile(char **buffer, char...
wrestlerdude
1

votes
1

answer
32

Views

Where is the following object property allocated?

I have the following code and I think that the arr property should be allocated on the heap, because the test object is allocated on the heap. But for some reason, the A destructor is being called, even though I do not call it explicitly. Is there explanation for this? CODE: class A { public: ~A(){...
Alex Lavriv
1

votes
0

answer
61

Views

How to set a strict memory limit to node js application?

I want to strictly limit allowed memory to my Node Js application. When I start an application with max_old_space_size=512 and start to fill some array with a lot of objects in a loop - application starts to consume more than 512 MB. It becomes even 1 GB. So if I understand correctly max_old_space_s...
LEQADA
1

votes
0

answer
88

Views

Array Slicing for recursive function in Java

I was working on a Java implementation of constructing a binary tree, given the pre/inorder traversal arrays. Code looks something like this (seems to work but I havent tested extensively) public static TreeNode buildTree(int[] inOrder, int[] preOrder) { if(inOrder.length
Robert Lemiesz
1

votes
1

answer
66

Views

PHP - Are there any real benefits to calling die() instead of echo?

I'm attempting to figure out if there are any benefits for memory usage if I call die(json_encode($array)); instead of just echoing the results and letting the script end. I imagine that it partly depends on the script, but I'm asking in the scenario where it works fine logically, but other conditio...
David Kamer
1

votes
0

answer
976

Views

PostgreSQL out of memory: Linux OOM killer

I am having issues with a large query, that I expect to rely on wrong configs of my postgresql.config. My setup is PostgreSQL 9.6 on Ubuntu 17.10 with 32GB RAM and 3TB HDD. The query is running pgr_dijkstraCost to create an OD-Matrix of ~10.000 points in a network of 25.000 links. Resulting table...
PaDe
1

votes
1

answer
147

Views

CoreMotion OperationQueue Issue on Apple Watch

Devices: iPhone 8, Apple Watch Series 3 I am currently working on a phone app + watch extension that streams CoreMotion data from all CoreMotion sensors using the standard APIs coupled with associated OperationQueues. I need to be able to stream all CoreMotion sensors in parallel, write the samples...
SDFire
1

votes
0

answer
332

Views

How do you dispose or free a file buffer in Node.js?

I have an object that contains a temporary file buffer: console.log(myObject) // output: { path: '/some/path', someBuffer: } After I'm done doing some processing on this buffer I want to release it. How exactly do you release or free a buffer from memory? Just set to null? myObject.someBuffer = nul...
Jake Wilson
1

votes
1

answer
424

Views

Does -XX:+UseSerialGC use main thread for GC

I have been reading (for example here and here) that with -XX:+UseSerialGC garbage collector only single thread is used for garbage collection. But it was not clear whether this 'single thread' is the main thread or a different single GC thread. So, I took a thread dump with and without -XX:+UseSeri...
pjj
1

votes
0

answer
96

Views

Best way to canvas drawing in Xamarin Android

I have a single Android View and i will draw set of canvas drawings (text drawing) in the same view. Now, I have a situation split those drawings in a separate views. Each text drawing will be in each view. So the number of child views will be the number of text. Due to this changes, Can anyone te...
VenkyDhana
1

votes
1

answer
99

Views

Not able to use all the memory channels using testpmd

I am using testpmd (DPDK 17.11.1). I created two ports P0 and P1 and I sent traffic from P0 to P1. And I found that it is using only two memory channels. Following is the command to start testpmd : ./testpmd -n4 -l2,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33 -- --rxd=4096 --txd=4096 --numa --rxq=8...
Anubhav Choudhary
1

votes
2

answer
68

Views

Accessing memory with various types through a void pointer

I know that using a union eliminates the worry of undefined behavior issues when accessing the same block of memory with different types, one at a time. I was wondering if the same is true for memory allocated with malloc() and a void pointer; does the following code exhibit any form of undefined be...
machine_1
1

votes
1

answer
170

Views

Objective-c objects in C++ container

Is it safe to place an Objective-C object in a C++ container? For example: @protocol MyProtocol // Some properties. @end @interface MyInterface : NSObject< MyProtocol > // some methods @end void foo() { std::vector vec; MyInterface *interface = [[MyInterface alloc] init]; vec.push_back(interface);...
Sanich
1

votes
0

answer
63

Views

Is it acceptable to use an allocated memory block's pointer as a unique internal hash or ID on a runtime-basis?

I am reviewing the code for a garbage collection system on my project and I was wondering -- is it acceptable to use a pointer as a unique internal hash or ID given that it holds the value of an address to a block of memory allocated by new or malloc/calloc/realloc? I only care about this property i...
VermillionAzure
1

votes
0

answer
89

Views

Malloc and Calloc not freeing correctly

Hello I seem to be having an issue with freeing some of my variables after creating them. Little background on my program. My program is reading MatrixMarket files and building a Matrix Structure from the information read in. I am then using the matrices to do scalar and vector multiplication. This...
JeanP
1

votes
0

answer
137

Views

Unicorn master memory increasing

I have a ruby service running with unicorn which spawns 20 child worker. When I start my service, unicorn master starts with approx 520 MB of memory and then master spawn 20 child worker. My service runs perfectly for 7-8 day, but gradually unicorn master memory is kept increasing and goes up to 1.3...
ssuummit
1

votes
0

answer
331

Views

Execute hosted service in per request scope

I have a background service that runs every 30 seconds in my ASP .NET Core WebApi application. Its registered to the service container in ConfigureServices in Startup.cs by the line services.AddSingleton(); Then I have this class and its upper class to execute a given method every 30 seconds: The ge...
hyvte
1

votes
0

answer
191

Views

What is Dynamic Linking?

Reading JVM-8 specification I am trying to understand what Dynamic Linking actually is. 2.6.3 Dynamic Linking Each frame (§2.6) contains a reference to the run-time constant pool (§2.5.5) for the type of the current method to support dynamic linking of the method code >>(1)>(2)>(3)
Adelin
1

votes
0

answer
453

Views

React Native Image Memory Issue

I am loading many images (More than 100) Using Image component from local assets (Xcode Image assets) and showing them using swiper component react-native-swiper. The issue I am facing is every time image is loaded the memory consumption increases and its never released. How do I release the memory?...
Bhumit Mehta

View additional questions