heap-memory

google common cache - default value of maximumSize (and other “optional” settings) - want a cache that uses all “available” memory

╄→гoц情女王★ 提交于 2020-01-02 08:35:38
问题 I just found Guava by searching for a cache API (it fits perfectly for my needs). But one question arose on reading the wiki and Javadoc - what are the default values of settings the CacheBuilder can take? The Javadoc states "These features are all optional" and "Constructs a new CacheBuilder instance with default settings, including strong keys, strong values, and no automatic eviction of any kind." In my opinion, a good default for maximumSize would be relative to Runtime.getRuntime()

Heap error in C

烂漫一生 提交于 2020-01-01 19:11:34
问题 I know this is really general, but I get "this" (see below) when I run my .c file in Visual C++ 2008 Express. It happens when I call malloc () . Take my work on this - I dynamically allocate memory properly. HEAP[Code.exe]: HEAP: Free Heap block 211a10 modified at 211af8 after it was freed Windows has triggered a breakpoint in Code.exe. This may be due to a corruption of the heap, which indicates a bug in Code.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12

Java heap space Xmx Xms parameters ignored

独自空忆成欢 提交于 2020-01-01 09:01:12
问题 I have a .JAR that apparently uses up too much memory, and throws an exception "Java heap space" (or something similar). So I tried running the .JAR via the CMD like this: C:\MyFolder>javaw -jar MyJar.jar -Xms64m -Xmx128m That did not solve the problem. Same error. Now, when I checked the Processes tab in the windows task manager, I noticed that the process of my jar has a lot less memory than what i asked for (same as running it without the parameters). Why is it ignoring the parameters?

How is heap and stack memories mananged, implemented, allocated [duplicate]

隐身守侯 提交于 2020-01-01 00:45:10
问题 This question already has answers here : Closed 10 years ago . Possible Duplicates: How is heap and stack memories mananged, implemented, allocated? Stack,Static and Heap in C++ In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap. How is each implemented? How is it managed (high level)? Does gcc preallocates a chunk of memory to be used for the stack and heap, and then doles out on request? Is original memory coming from RAM? Can a

Why is the default size of PermGen so small?

爱⌒轻易说出口 提交于 2019-12-31 10:49:33
问题 What would be the purpose of limiting the size of the Permgen space on a Java JVM? Why not always set it equal to the max heap size? Why does Java default to such a small number of 64MB? Are they trying to force people to notice permgen issues in their code by doing this? If my app uses 85MB of permgen, then it might be safe to set it to 96MB but why set it so small if its just really part of the main heap? Wouldn't it be efficient to allow the JVM to use as much PermGen as the heap allows?

PermGen and Heap, Difference and their significance

萝らか妹 提交于 2019-12-31 09:45:08
问题 Friends, Can you please give me significance, difference and uses for Heap and PermGen. Also it would be good to know what class are loaded in them respectively. Explanation related to Java VM specification would be really helpful Thanks Punith 回答1: Memory(Heap) is managed in generations, or memory pools holding objects of different ages. Garbage collection occurs in each generation when the generation fills up. Objects are allocated in a generation for younger objects or the young generation

Does printf() allocate memory in C?

对着背影说爱祢 提交于 2019-12-30 11:08:40
问题 This simple method just creates an array of dynamic size n and initializes it with values 0 ... n-1. It contains a mistake, malloc() allocates just n instead of sizeof(int) * n bytes: int *make_array(size_t n) { int *result = malloc(n); for (int i = 0; i < n; ++i) { //printf("%d", i); result[i] = i; } return result; } int main() { int *result = make_array(8); for (int i = 0; i < 8; ++i) { printf("%d ", result[i]); } free(result); } When you check the output you will see that it will print

Initializing numpy array from np.empty

别来无恙 提交于 2019-12-30 08:47:07
问题 How are the sign bits determined when initializing an ndarray from empty memory? >>> np.random.randn(3,3) array([[-0.35557367, -0.0561576 , -1.84722985], [ 0.89342124, -0.50871646, 1.31368413], [ 0.0062188 , 1.62968789, 0.72367089]]) >>> np.empty((3,3)) array([[0.35557367, 0.0561576 , 1.84722985], [0.89342124, 0.50871646, 1.31368413], [0.0062188 , 1.62968789, 0.72367089]]) These float values initialized from empty memory have lost their signs † . Why is that? † Note: this result relies on

When will the new String() object in memory gets cleared after invoking intern() method

你说的曾经没有我的故事 提交于 2019-12-30 06:53:07
问题 List<String> list = new ArrayList<>(); for (int i = 0; i < 1000; i++) { StringBuilder sb = new StringBuilder(); String string = sb.toString(); string = string.intern() list.add(string); } In the above sample, after invoking string.intern() method, when will the 1000 objects created in heap (sb.toString) be cleared? Edit 1: If there is no guarantee that these objects could be cleared. Assuming that GC haven't run, is it obsolete to use string.intern() itself? (In terms of the memory usage?) Is

How to increase the heap size of the google cloud app engine?

泄露秘密 提交于 2019-12-29 08:25:10
问题 I am now using Google Cloud App Engine Standard environment for Java application and I am getting outOfMemory Error cause the Java heap size` is quite filled. I know why cause I'm processing a lot of data which might reach 1GB, so how to increase the heap size allocated for a java app running in App Engine Standard environment. 回答1: I've fixed my problem by moving to java8 and now Im using java 8 environmental variables to increase the java heap size by adding this to the appengine-web.xml