heap

Are there tools to analyse large Java heap dumps without loading the complete hprof file?

若如初见. 提交于 2019-12-22 04:36:31
问题 I use Eclipse MAT to analyse hprof files. It is very good but if you have a 2Gb heap dump then you need to run MAT with a 2Gb+ heap size itself to be able to load the complete heap dump. I was wondering if anyone knows of a tool that could analyse a 2Gb hprof file without using that much memory itself (e.g. it doesn't load the complete file but somehow walks through it)? This would be useful if a hprof file gets generated on a customer server as I could then run some analysis on the server

Armadillo: efficient matrix allocation on the heap

梦想的初衷 提交于 2019-12-21 20:33:17
问题 I'm using Armadillo to manipulate large matrices in C++ read from a CSV-file. mat X; X.load("myfile.csv",csv_ascii); colvec x1 = X(span::all,0); colvec x2 = X(span::all,1); //etc. So x1,...,xk (for k=20 say) are the columns of X. X will typically have rows ranging from 2000 to 16000. My question is: How can I allocate (and subsequently deallocate) X onto the heap (free store)? This section of Armadillo docs explains auxiliary memory allocation of a mat. Is this the same as heap allocation? It

Mockito throws an OutOfMemoryError on a simple test

こ雲淡風輕ζ 提交于 2019-12-21 12:31:14
问题 I tried using Mockito to simulate a database pool (for retrieving data only), but when running a performance test that retrieved many mock connections over a period of time, it ran out of memory. Here is a simplified self-contained code, which throws an OutOfMemoryError after about 150,000 loop iterations on my machine (despite that nothing seems to be saved globally, and everything should be garbage collectable). What am I doing wrong? import static org.mockito.Mockito.when; import java.sql

Python: setting memory limit for a particular function call

允我心安 提交于 2019-12-21 09:18:03
问题 In a Python script, I want to set a memory limit for a certain function call. I looked at how to limit heap size; however, I don't want to limit the memory of the entire running Python process -- i.e. setting the memory limit before and after the function call. Is there any way to make a function call with a given amount of memory, so that the memory limit doesn't affect the caller? 回答1: No, this is impossible. Python doesn't keep track of which functions are responsible for allocating new

Can one (re)set all the values of an array in one line (after it has been initialized)?

心已入冬 提交于 2019-12-21 07:48:26
问题 In C, I know I can make an array like this int myarray[5] = {a,b,c,d,e}; However, imagine the array was already initialised like int myarray[5]; and then at some point afterwards, I wanted to set/change all the values without going myarray[0] = a; myarray[1] = b; myarray[2] = c; myarray[3] = d; myarray[4] = e; but rather, something more like myarray = {a,b,c,d,e}; The reason why I ask this is because if I declare my array on the heap, I will initialise the array like: int* myarray = malloc(5

Does a garbage collector collect stack memory, heap memory, or both?

随声附和 提交于 2019-12-21 07:13:38
问题 I read lot of articles about garbage collection and almost all article tells about heap memory. so my question is "garbage collection collects stack memory or heap memory or both". 回答1: It collects heap memory. Usually, stack memory is collected automatically when the execution path reaches the end of the scope. e.g.: void fun() { int n; // reservation on the stack as part of the activation record ... } // returning the stack pointer to where it was before entering the scope In fact, in a

Impact of heap parameters on GC/performance?

帅比萌擦擦* 提交于 2019-12-21 06:55:53
问题 Most of the place on net , I get below info about heap parameters -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size Here is mine understanding/question when I mention -Xms 512M -Xmx 2048M parameters , -Xms :- My understanding is if my java process is actually needed only 200M , with mention of -Xms 512M , java process will still be assigned only 200M(actual memory required) instead of 500M . But if I already know that my application is going to take this 512M memory

Android, I see heap growing, but I want it to stop

僤鯓⒐⒋嵵緔 提交于 2019-12-21 05:36:05
问题 I see my heap growing and I know it will eventually crash on any device since it just keeps growing. Grow heap (frag case) is seen throughout the logs on my phone it will crash the app at 32mb used. Other phones will of course be 16mb, if there are any with that few resources that run android 2.2 Now, I am using recycle() on my bitmaps, setting things to null, popping items from complex data structures, and using System.gc() to invoke garbage collection, throughout the app but, the heap still

C++ STL--make_heap with pair<int,string> as data type

本秂侑毒 提交于 2019-12-21 05:18:08
问题 I know how does heap work and how it arranges min and max elements. It is easy, if vector contains only int , to apply make_heap in STL. But how to apply make_heap() if vector contains structure of string and int. Iwant to make heap based on int value in structure. Please tell me how to do that. 回答1: You have to provide comparison function for your structure: struct A { int x, y; }; struct Comp { bool operator()(const A& s1, const A& s2) { return s1.x < s2.x && s1.y == s2.y; } }; std::vector

Heap Memory and Slab allocation

旧城冷巷雨未停 提交于 2019-12-21 04:41:05
问题 I'm confused regarding heap and free list . I have a few questions and I have my own understanding of how malloc works in C. Please correct me if I'm wrong. Is the heap memory organized as a linked list (free list) of data blocks ? Is there a difference between heap memory and free list ? My understanding of storage allocation (open for improvement) :- When we call malloc, it allocates memory in the heap, and it does so by picking a data block of suitable size from the free list , right ?