Witam
mam mały problem z wyciekiem pamięci prosze luknąć na mój kod gdzie robie jakiś błąd? Allocated Objects przy klasie char[] cały czas rośnie w ciągu kilku minut dochodzi do 1miliona. czy przypisanie temp+="test" jest nieprawidłowe?
import java.util.Timer;
public class test3 {
public static String dane="";
public static void aktualizacja() {
String temp="";
for (int xx=1;xx<=7000;xx++){
temp+="test";
}
dane=temp;
}
public static void main(String [] args) {
System.out.println("start test3");
Timer timer1 = new Timer(); test10 timer1_task = new test10(); timer1.schedule (timer1_task, 0, 1000);
}
}
import java.util.TimerTask;
class test10 extends TimerTask {
public void run() {
test3.aktualizacja();
}
}