garbage-collection

Garbage collection of String literals

风格不统一 提交于 2019-12-27 09:51:03
问题 I am reading about Garbage collection and i am getting confusing search results when i search for String literal garbage collections. I need clarification on following points: If a string is defined as literal at compile time [e.g: String str = "java" ] then will it be garbage collected? If use intern method [e.g: String str = new String("java").intern() ] then will it be garbage collected? Also will it be treated differently from String literal in point 1. Some places it is mentioned that

Garbage collection of String literals

风流意气都作罢 提交于 2019-12-27 09:50:49
问题 I am reading about Garbage collection and i am getting confusing search results when i search for String literal garbage collections. I need clarification on following points: If a string is defined as literal at compile time [e.g: String str = "java" ] then will it be garbage collected? If use intern method [e.g: String str = new String("java").intern() ] then will it be garbage collected? Also will it be treated differently from String literal in point 1. Some places it is mentioned that

Does GC release back memory to OS?

徘徊边缘 提交于 2019-12-27 08:54:07
问题 When the garbage collector runs and releases memory does this memory go back to the OS or is it being kept as part of the process. I was under the strong impression that the memory is never actually released back to OS but kept as part of the memory area/pool to be reused by the same process. As a result the actual memory of a process would never decrease. An article that reminded me was this and Java’s Runtime is written in C/C++ so I guess the same thing applies? Update My question is about

LIfecycle of mapping of native resources in Java (and how to keep them in sync)

社会主义新天地 提交于 2019-12-25 09:35:08
问题 Please consider this scenario: There is a connection between Java and some (expensive) native resources, which is a requirement to be mapped to Java. The question is about the lifecycle of the resources and how these will be available on both native and java, as long as they are needed. Let's assume that we can have an active JNI connection both ways, as required. The rules are as follows: The resources will stay live as long as the wrapper Java object needs them. The Java object could be

GC crashes QML-Application

泄露秘密 提交于 2019-12-25 07:59:54
问题 Do not fear! This is not production code. It is just to learn new things about QML! I do not seek 'you shall not do something like this - do it like that.' I am more interested in the internals of QML Consider the following QML-Code import QtQuick 2.4 import QtQuick.Window 2.0 Window { id: root width: 800 height: 600 visible: true GridView { width: 800 height: 200 model: 4000 flow: GridView.FlowTopToBottom delegate: Rectangle { id: myDelegate width: 100 height: 100 border.width: 1 Column {

Sub-subReport execution returns “java.lang.OutOfMemoryError: GC overhead limit exceeded”

情到浓时终转凉″ 提交于 2019-12-25 07:47:50
问题 Here's my problem: I have a JasperReport ( mainReport ) with one subreport ( subReport ) which, at the same time, have one subreport ( subSubReport ). My problem comes when I try to execute it from my web app. Those reports are extracted from an Oracle database, thus I'm passing an InputStream as "path" for them. Since I've been testing "paths" as InputStream (obtained from the same database) I know it works when I have a simple mainReport -> subReport hierachy... that's why I'm pretty sure

Memory problems with Java in the context of Hadoop

寵の児 提交于 2019-12-25 07:20:25
问题 I want to compute a multiway join in Hadoop framework. When the records of each relation get bigger from a threshold and beyond I face two memory problems, 1) Error: GC overhead limit exceeded, 2) Error: Java heap space. The threshold is the 1.000.000 / relation for a chain join and a star join. In the join computation I use some hash tables i.e. Hashtable< V, LinkedList< K>> ht = new Hashtable< V, LinkedList< K>>( someSize, o.75F); These errors occur when I hash the input records and only

File buffer flushing and closing in Python with variable re-assign

一个人想着一个人 提交于 2019-12-25 04:39:20
问题 Had an interesting experience with Python's file buffering and wanted to know that I understand it correctly. Given [Python 2.7 shell] ... model = (really big Numpy model) f = open('file.out','w') pickle.dump(model, f) (pickle.dump() finishes while I'm doing other things) [Bash shell] $ ls -l -rw-r--r-- 1 john staff 270655488 Dec 6 21:32 file.out [Return to Python shell] model = (different really big Numpy model) f = open('newfile.out','w') pickle.dump(model,f) (pickle.dump() finishes) [Bash

How to supress the creation of an (.net) Exception object?

做~自己de王妃 提交于 2019-12-25 04:34:12
问题 If I do not care about a thrown Exception. Can I code in a way as not to create it? In other words, can an Exception be thrown but no Exception object be created? An example - Simple example using a System.Net.Sockets.Socket Socket acceptingSocket; acceptingSocket.Blocking = false; while(condition) { try { Socket acceptedSocket = acceptingSocket.Accept(); //(i) doWork(acceptedSocket); } catch{} } because the socket is in non-blocking mode if there is no connection to accept a SocketException

How to supress the creation of an (.net) Exception object?

家住魔仙堡 提交于 2019-12-25 04:34:02
问题 If I do not care about a thrown Exception. Can I code in a way as not to create it? In other words, can an Exception be thrown but no Exception object be created? An example - Simple example using a System.Net.Sockets.Socket Socket acceptingSocket; acceptingSocket.Blocking = false; while(condition) { try { Socket acceptedSocket = acceptingSocket.Accept(); //(i) doWork(acceptedSocket); } catch{} } because the socket is in non-blocking mode if there is no connection to accept a SocketException