I have the following loop that listens for UDP messages coming in
public void run(){
int count = 0;
boolean loopRecv = true;
while (loopRecv) {
count++;
if (count == 500) {
loopRecv = false;
System.out.println("break from loop");
count = 0;
}
}
}
The problem is that within a few hours, I receive an out of memory exception. Also I am monitoring the memory in Top and it is growing slowly.
I thought that breaking from this loop would remove that allocated stack frames, but this doesn't seem to be the case.
How can i run this loop without receiving the out of memory error?