mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed memory leak by forcing garbage collection
This commit is contained in:
@@ -13,6 +13,9 @@ import org.slf4j.LoggerFactory;
|
|||||||
import seng302.discoveryServer.DiscoveryServer;
|
import seng302.discoveryServer.DiscoveryServer;
|
||||||
import seng302.visualiser.controllers.ViewManager;
|
import seng302.visualiser.controllers.ViewManager;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(App.class);
|
private static Logger logger = LoggerFactory.getLogger(App.class);
|
||||||
@@ -92,6 +95,17 @@ public class App extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
/*
|
||||||
|
* Do not trust Java to do garbage collection
|
||||||
|
*/
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
System.gc();
|
||||||
|
}
|
||||||
|
}, 0, 1200);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
parseArgs(args);
|
parseArgs(args);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
|||||||
@@ -158,7 +158,13 @@ public abstract class Message {
|
|||||||
* @return The current buffer as a byte array
|
* @return The current buffer as a byte array
|
||||||
*/
|
*/
|
||||||
public byte[] getBuffer(){
|
public byte[] getBuffer(){
|
||||||
return buffer.array();
|
byte[] bytes = buffer.array();
|
||||||
|
|
||||||
|
// buffer.reset();
|
||||||
|
// buffer.clear();
|
||||||
|
// buffer = null;
|
||||||
|
|
||||||
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user