We have several java services running using JSW. An additional service monitors them and sends information about their states. We detected that after several hours the server started to swap. Using the SysInternals ProcessExplorer we detected the monitor service to hog memory.
The problem is reproducable using the following code-snipplet and the processexplorer (TaskManager should do the job, too)
------------->
package com.smsdemag.de.ve.lib.win32service;
import org.tanukisoftware.wrapper.WrapperManager;
import org.tanukisoftware.wrapper.WrapperWin32Service;
public class Test
{
public static void main(String[] args)
{
while(true)
{
for(final WrapperWin32Service service : WrapperManager.listServices())
{
// We monitor the services here...
}
try
{
Thread.sleep(1000);
}
catch(InterruptedException e)
{}
}
}
}
<------------------------------------
When executing the code, you see memory consumption of the JVM increasing about 100 kb every few seconds.
I don't know the C-side implementation, but it would be nice to offer a public dispose()-method, which frees the resources. Additionally the finalize() method should call dispose().
Regards,
Sebastian Kopsan
Logged In: YES
user_id=228081
Originator: NO
Sebastian,
Thanks for pointing this out. I have confirmed the problem and will look into it.
Cheers,
Leif
Logged In: YES
user_id=228081
Originator: NO
Sebastian,
Ok. This has been fixed. I was forgetting to free up a malloced array. Surprised I missed it, the leak was fairly significant.
The API remains unchanged. The list you receive from the WrapperManager.listServices call will get GCed like any other Java array.
This fix will be in the upcoming 3.2.4 release.
Cheers,
Leif
Logged In: NO
Thank you for fixing it...and for the JSW project itself :)
Thank you very much.
Regards,
Sebastian Kopsan