heap-memory

Why do we even need the “delete[]” operator?

a 夏天 提交于 2019-11-28 09:37:14
This is a question that's been nagging me for some time. I always thought that C++ should have been designed so that the "delete" operator (without brackets) works even with the "new[]" operator. In my opinion, writing this: int* p = new int; should be equivalent to allocating an array of 1 element: int* p = new int[1]; If this was true, the "delete" operator could always be deleting arrays, and we wouldn't need the "delete[]" operator. Is there any reason why the "delete[]" operator was introduced in C++? The only reason I can think of is that allocating arrays has a small memory footprint

How to set Java heap size (Xms/Xmx) inside Docker container?

心不动则不痛 提交于 2019-11-28 08:56:50
As of raising this question, Docker looks to be new enough to not have answers to this question on the net. The only place I found is this article in which the author is saying it is hard, and that's it. jbarrueta I agree that it depends on what container you're using. If you are using the official Tomcat image , it looks like it's simple enough, you will need to pass the JAVA_OPTS environment variable with your heap settings: docker run --rm -e JAVA_OPTS='-Xmx1g' tomcat See How to set JVM parameters? Note that in a docker-compose.yml file - you'll need to leave out the double-quotes:

Is stack memory contiguous physically in Linux?

梦想与她 提交于 2019-11-28 08:42:12
问题 As far as I can see, stack memory is contiguous in virtual memory address, but stack memory is also contiguous physically? And does this have something to do with the stack size limit? Edit: I used to believe that stack memory doesn't has to be contiguous physically, but why do we think that stack memory is always quicker than heap memory? If it's not physically contiguous, how can stack take more advantage of cache? And there is another thing that always confuse me, cpu executes directives

Android Heap memory increase

心已入冬 提交于 2019-11-28 08:02:03
问题 I am developing an application on Android 2.2 which takes extensive memory and my most operation cannot be complete because of low memory. Could anybody give me solution that how can I increase my application heap size. I have tried android:largeHeap="true" but it is not supported in Android API-8. I am thankful you all. 回答1: Heap size depends on the hardware your running your app an. For example 16mb on a G1 and 32mb on a nexus one. Don't think there is much you can do about it. If you

Java heap dump error with jmap command : Premature EOF

柔情痞子 提交于 2019-11-28 07:13:36
问题 I have encountered below exception during execution of below command jmap -dump:format=b,file=heap_dump.bin <process_id> output: Dumping heap to <file_name> Exception in thread "main" java.io.IOException: Premature EOF at sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:248) at sun.tools.attach.LinuxVirtualMachine.execute(LinuxVirtualMachine.java:199) at sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:217) at sun.tools.attach

How to configure heap size when starting a Spring Boot application with embedded tomcat?

。_饼干妹妹 提交于 2019-11-28 06:18:43
I am trying to deploy a Spring Boot powered web app to production. The app is built with Spring Boot 1.0.1 and has the default Tomcat 7 embedded as application server. I want to allocate larger memory to the app when start the app with java -jar myapp.jar command line. Should I use JVM parameter such as -Xms -Xmx or use environment variable such as JAVA_OPTS ? I have tried to look for the answer in documentation or google it, but did not get answer. Can anyone give some hints? Just use whatever normal mechanism you would to set up the JVM. Docs are available on the command line: $ java -X ...

xlConnect R use of JVM memory

你说的曾经没有我的故事 提交于 2019-11-28 06:11:19
问题 I'm running into a problem with JVM memory using XLConnect (Mirai Solutions) in R. Data loads into R just fine using loadWorkbook or readWorksheetFromFile , but larger data (data frames about 3MB) get stuck while being written to the JVM during export with any of the export functions ( writeNamedRegion , writeWorksheetToFile , etc.), and R stops responding. I've reset the java parameters using options(java.parameters = "-Xmx1500m") , and this increased the size of the data frames I was able

Java memory areas in java 8

ⅰ亾dé卋堺 提交于 2019-11-28 05:48:40
问题 I have read a lot about java memory areas, but looks like it is just a mess. Mostly due to the introduction of a new MetaSpace area instead of PermGen in java8. And there are questions now: What areas does the heap include in java8+ ? Where the static methods and variables are stored before java8 and java8+ ? Does the MetaSpace store anything except class meta-data info ? Does the structure of memory areas depend on the implementation of JVM ? Thank you for your answers. 回答1: Does the

Set default heap size in Windows [duplicate]

試著忘記壹切 提交于 2019-11-28 04:34:14
This question already has an answer here: how to increase java heap memory permanently? 4 answers I want to set Java heap size permanently and don't want to run every jar file with options. I use Windows and Java 1.7. Setup JAVA_OPTS as a system variable with the following content: JAVA_OPTS="-Xms256m -Xmx512m" After that in a command prompt run the following commands: SET JAVA_OPTS="-Xms256m -Xmx512m" This can be explained as follows: allocate at minimum 256MBs of heap allocate at maximum 512MBs of heap These values should be changed according to application requirements. EDIT: You can also

out of memory error, java heap space

只愿长相守 提交于 2019-11-28 04:15:35
问题 I try to read log file with more than 4 million lines and size more than 400 MB, but I get Out of Memory Error : java heap space . This is my code : File file = new File("C:\\file.log"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); StringBuilder stringBuffer = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { stringBuffer.append(line); } I tried to increase heap memory to 1GB, but still get