powered by Jive Software

Allways cancel PacketColletor

Hi,

I have the strong feeling, that it should be noted, that you allways have to cancel the PacketCollector manually via .cancel() if you don’'t use it anymore.

If you don’'t do so, it will remain in memory till judgement day.

In my case I created a PacketCollector every time I send a message to wait for the explicit answer. Failing to to cancel it produced every 200 Messages (200 Packet Collectors!!!) an OutOfMemoryError which was very hard to find indeed.

FloBa

One more word if you are using the debugging window:

By closing the debugging window, it doesn’'t mean there is no more debugging done. Indeed it is only invisible and debugging-output is further written to it.

With many and big messages memory will run low after quiet a short while.

(was the main Problem with my OutOfMemoryError)

FloBa

FloBa,

Two good points. I’'ll run a MemoryProfiler to check if anything else is kept “unwanted” in memory.

Thanks for the bugs report.

– Gato

FloBa,

One thing we plan to implement in the future is to use SoftReferences for PacketCollector objects. This would allow garbage collection to automatically clean up the objects in case people forgot to call cancel().

Regards,

Matt