[Engine-devel] Java process increasing resident memory
Michael Pasternak
mpastern at redhat.com
Sun Feb 3 08:56:07 UTC 2013
On 01/31/2013 12:50 AM, Moti Asayag wrote:
> On 01/29/2013 10:27 AM, navin p wrote:
>> > Hi,
>> > I wrote this sample code and the resident memory of the process is
>> > increasing gradually over time. What could be the reason ? I don't see
>> > any obvious leaks in my program. Could it be that the API is not
>> > freeing/deleting memory ?
> By monitoring the program, it seems that the failure is due to constant
> threads creation by invoking the "new API()" call:
>
> Exception in thread "main" java.lang.OutOfMemoryError: unable to create
> new native thread
> at java.lang.Thread.start0(Native Method)
> at java.lang.Thread.start(Thread.java:691)
> at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.createPoolingClientConnectionManager(ConnectionsPoolBuilder.java:182)
> at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.createDefaultHttpClient(ConnectionsPoolBuilder.java:160)
> at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.build(ConnectionsPoolBuilder.java:234)
> at org.ovirt.engine.sdk.Api.<init>(Api.java:82)
> at collectHosts.main(collectHosts.java:102)
>
>
> By pulling the API instantiation outside of the loop, problem solved,
> since only a single thread is created to monitor the idle/expired
> connections.
Thanks Moti,
I already suggested navin to take SDK proxy initiation out of his while loop.
>
>
> Michael, wouldn't you suggest adding some sort of API.shutdown() method
> in order to release resources used by it including the connection
> monitor and any other live connections if exists?
no need for that, in SDK i have dedicated thread (watchdog) for that.
>
--
Michael Pasternak
RedHat, ENG-Virtualization R&D
More information about the Engine-devel
mailing list