mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
removed finalize methods because of a hint in
http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/memleaks.html#gbyvh The finalize method prevents that the memory, used by the objects containing the finalize method, is collected and available for the garbage collector. Instead, the memory allocated by such classes are enqueued to a java-internal finalize queue runner. This slows down all operations that uses a lot of object containing finalize methods. this fix does not remove all finalize method, but such that may be used for throw-away objects that are allocated many times. This should cause a better run-time performance and less OutOfMemoryErrors git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6835 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
bfa35d6d20
commit
4cd5418963
|
@ -85,11 +85,6 @@ public class CrawlProfile {
|
|||
this.profileTable = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalize() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return profileTable.size();
|
||||
}
|
||||
|
|
|
@ -176,14 +176,4 @@ public class ResponseContainer {
|
|||
public void setAccountingName(final String accName) {
|
||||
incomingAccountingName = accName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#finalize()
|
||||
*/
|
||||
@Override
|
||||
protected void finalize() {
|
||||
closeStream();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -656,10 +656,6 @@ public final class serverCore extends AbstractBusyThread implements BusyThread {
|
|||
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
private void listen() {
|
||||
try {
|
||||
// start dialog
|
||||
|
|
|
@ -590,10 +590,5 @@ dc_rights
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void finalize() throws Throwable {
|
||||
this.close();
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,11 +95,6 @@ public abstract class AbstractScraper implements Scraper {
|
|||
tags1 = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,10 +67,5 @@ public abstract class AbstractTransformer implements Transformer {
|
|||
tags0 = null;
|
||||
tags1 = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -530,13 +530,6 @@ public final class TransformerWriter extends Writer {
|
|||
// if you want to flush all, call close() at end of writing;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws IOException {
|
||||
// if we are forced to close, we of course flush the buffer first,
|
||||
// then close the connection
|
||||
close();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
final char quotechar = (inSingleQuote) ? singlequote : doublequote;
|
||||
if (buffer != null) {
|
||||
|
|
|
@ -76,9 +76,11 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
|
|||
final int orderbound = (int) NaturalOrder.decodeLong(b, 10, 4);
|
||||
assert orderbound >= 0 : "orderbound = " + orderbound;
|
||||
if (orderbound < 0) return new RowSet(rowdef); // error
|
||||
final byte[] chunkcache = new byte[size * rowdef.objectsize];
|
||||
long alloc = ((long) size) * ((long) rowdef.objectsize);
|
||||
assert alloc <= Integer.MAX_VALUE : "alloc = " + alloc;
|
||||
final byte[] chunkcache = new byte[(int) alloc];
|
||||
//assert b.length - exportOverheadSize == size * rowdef.objectsize : "b.length = " + b.length + ", size * rowdef.objectsize = " + size * rowdef.objectsize;
|
||||
if (b.length - exportOverheadSize != size * rowdef.objectsize) {
|
||||
if (b.length - exportOverheadSize != alloc) {
|
||||
Log.logSevere("RowSet", "exportOverheadSize wrong: b.length = " + b.length + ", size * rowdef.objectsize = " + size * rowdef.objectsize);
|
||||
return new RowSet(rowdef);
|
||||
}
|
||||
|
|
|
@ -143,10 +143,4 @@ public final class ByteCountInputStream extends FilterInputStream {
|
|||
byteCountInfo.clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected final void finalize() throws Throwable {
|
||||
if (!this.finished)
|
||||
finish();
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,9 +132,4 @@ public final class ByteCountOutputStream extends BufferedOutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
protected final void finalize() throws Throwable {
|
||||
if (!this.finished)
|
||||
finish();
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,10 +82,6 @@ public class ReferenceIterator <ReferenceType extends Reference> implements Clon
|
|||
if (blobs != null) this.blobs.close();
|
||||
blobs = null;
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
public CloneableIterator<ReferenceContainer<ReferenceType>> clone(Object modifier) {
|
||||
if (blobs != null) this.blobs.close();
|
||||
|
|
|
@ -164,10 +164,4 @@ public class XMLTables {
|
|||
commit(true);
|
||||
}
|
||||
|
||||
// we finalize the operation by saving everything throug the scheduler
|
||||
// this method is called by the java GC bevore it destroys the object
|
||||
protected void finalize() throws IOException {
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user