Saturday 15 February 2014

java while loop with periodic break receives out of memory exception -


I have the following loop that hears for UDP messages

  public zero run () {Int count = 0; Boolean loop RECV = true; While (LoRRCV) {count ++; If (calculation == 500) {loopRecv = false; System.out.println ("Break With Loop"); Calculation = 0; }}}   

The problem is that within a few hours, I get the memory exception, besides I am monitoring the memory in the top and it is gradually increasing.

I thought that breaking the loop would remove all those stacked frames, but this does not seem like that.

How do I run this loop without a memory error?

Every 500th in your loop, you run .

  play (). . 500 repeaters run (). . . 500 in iterative runs ()   

Your loopRecv boolean is not doing anything though you set loopRecv to false Make a recursive call immediately, make the boolean assignment useless! Therefore, stack overflow error . Instead, why do not you alternate your method instead of implementing it instead? Consider breaking one It is not very clear to complete your work.

No comments:

Post a Comment