mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-01-25 19:28:52 +00:00
Memory leak fix:
+ cause of the memory leak was not closing file writer for the state dump
This commit is contained in:
parent
178f3ae7b0
commit
685fa48a6b
@ -316,13 +316,15 @@ public class Repository {
|
|||||||
blockNumber, txNumber, txHash.substring(0, 8));
|
blockNumber, txNumber, txHash.substring(0, 8));
|
||||||
|
|
||||||
File dumpFile = new File(System.getProperty("user.dir") + "/" + dir + fileName);
|
File dumpFile = new File(System.getProperty("user.dir") + "/" + dir + fileName);
|
||||||
|
FileWriter fw = null;
|
||||||
|
BufferedWriter bw = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
dumpFile.getParentFile().mkdirs();
|
dumpFile.getParentFile().mkdirs();
|
||||||
dumpFile.createNewFile();
|
dumpFile.createNewFile();
|
||||||
|
|
||||||
FileWriter fw = new FileWriter(dumpFile.getAbsoluteFile());
|
fw = new FileWriter(dumpFile.getAbsoluteFile());
|
||||||
BufferedWriter bw = new BufferedWriter(fw);
|
bw = new BufferedWriter(fw);
|
||||||
|
|
||||||
List<ByteArrayWrapper> keys = this.detailsDB.dumpKeys();
|
List<ByteArrayWrapper> keys = this.detailsDB.dumpKeys();
|
||||||
|
|
||||||
@ -351,9 +353,13 @@ public class Repository {
|
|||||||
|
|
||||||
// {address: x, nonce: n1, balance: b1, stateRoot: s1, codeHash: c1, code: c2, sotrage: [key: k1, value: v1, key:k2, value: v2 ] }
|
// {address: x, nonce: n1, balance: b1, stateRoot: s1, codeHash: c1, code: c2, sotrage: [key: k1, value: v1, key:k2, value: v2 ] }
|
||||||
}
|
}
|
||||||
bw.close();
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (bw != null)bw.close();
|
||||||
|
if (fw != null)fw.close();
|
||||||
|
} catch (IOException e) {e.printStackTrace();}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user