Apart from the obvious streams not closed I could see nothing wrong in the code.
However I decided to have a deeper look and i issued the following command
ltrace -fCS -p `pidof tomcat` 2>leak.out 1>&2
To my surprise I have seen lots of SYS_fork() in the output meaning that the library forked the entire appserver :) - WOW. It was not an disaster because fork() is COW so the memory is duplicated only when the children write something - but as this is an appserver it is kind of a heavy operation to fork it every time.
This also explained why the system seemed to leak memory. During the execution of the children processes new buffers are allocated and as the new processes have their own lifecycle it consumes quite a lot of memory.
No comments:
Post a Comment