# Out of memory error in smart client

**URL:** <https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409>\
**Category:** Classic Servoy\
**Created:** [January 25, 2012, 3:11pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409 "2012-01-25T15:11:16Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 25, 2012, 3:11pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/1 "2012-01-25T15:11:16Z")

</div>

Hi,  
I’ve been having a memory issue with my application server.  
I’m using Jasper Reports to make all my reports.  
Only when I print a specially complex report my server crashes and reboots. The report is printed correctly but the moment any client takes action after printing the report everything crashes.  
I tried updating the heap memory from 64 to 256 but it seems to have no effect at all.

This is the exception trown in servoy log.

```auto
Exception in thread "2 way Server Acceptor" java.lang.OutOfMemoryError: unable to create new native thread
Filter trigger matched. Restarting JVM.
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.execute(Unknown Source)
at com.servoy.j2db.rmi.ServerTwoWaySocketFactory$TwoWayServerSocket.run(ServerTwoWaySocketFactory.java:607)
at java.lang.Thread.run(Unknown Source)

```

I’m using Servoy 6.0 with Java 1.6.0\_23.  
Jasper version is 3.7.1 and my server runs with Win Server 2008

Any ideas??

Thanks for the help

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [January 26, 2012, 12:35pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/2 "2012-01-26T12:35:49Z")

</div>

It’s your servoy application server that crashes or the smart client that requested the report?  
What heap size did you increase? The smart client heap size or the application server heap size?

---

<div class="post-metadata">

**Author:** ![Thomas\_Parry](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Thomas\_Parry](https://forum.servoy.com/u/Thomas_Parry)\
**Post date:** [January 26, 2012, 1:11pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/3 "2012-01-26T13:11:36Z")

</div>

When you say complex report do you also mean very long in terms of pages output from JasperReports?  
There is a known issue with in memory reports that are very lengthy. Search forum.

---

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 26, 2012, 2:46pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/4 "2012-01-26T14:46:30Z")

</div>

The server crashes, and i increased both heaps, the client one to 256 and the server one to 1024 maybe i need more. And yes it is a potentially very long in term pages report (could be like 300-400 pages long) ill look for that known issue.

---

<div class="post-metadata">

**Author:** ![Thomas\_Parry](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Thomas\_Parry](https://forum.servoy.com/u/Thomas_Parry)\
**Post date:** [January 26, 2012, 7:04pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/5 "2012-01-26T19:04:02Z")

</div>

hint: have a look at “virtualizer” options in the forum  
Also:

> **[Defect #340: virtualizer files are never cleaned up! - Servoy JasperReports...](https://www.servoyforge.net/issues/340)**
>
> Redmine

EDIT:  
For the technically minded:  
[http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/sample.reference/virtualizer/index.html](http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/sample.reference/virtualizer/index.html)

---

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 27, 2012, 12:27pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/6 "2012-01-27T12:27:32Z")

</div>

ive been reading about the virtualizer but i think im not getting how to use it quite right.  
i added this to my parameters object

```auto
o.VIRTUALIZER_TYPE = "file"; //possible options: file, swapFile, gZip
	o.PAGE_OUT_DIR = "\\\\desarrollo\\C\\Servoy6\\application_server\\server\\work\\";

```

but what about the other parameters in the function call? how do i make this work?

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [January 27, 2012, 12:40pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/7 "2012-01-27T12:40:51Z")

</div>

Have a look at the docs for the different types of virtualisers, here’s the code we are using:

```auto
var _server_dir = plugins.jasperPluginRMI.reportDirectory
plugins.jasperPluginRMI.runReport(_fs,'sections_20.jasper',null,'view',{VIRTUALIZER_TYPE: 'swapFile', PAGE_OUT_DIR: _server_dir + '/tmp/', header1: _header1, header2: _header2, header_img: _header_img, language: globals.data_language},_locale);

```

---

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 27, 2012, 1:18pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/8 "2012-01-27T13:18:09Z")

</div>

ive tryied this with both the swapFile and the file virtualizer but the server is still crashing afterwards, how can i assure myself that it is actually using the virtualizer? and if it is using it, could it be something else that makes my server crash?

---

<div class="post-metadata">

**Author:** ![Thomas\_Parry](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Thomas\_Parry](https://forum.servoy.com/u/Thomas_Parry)\
**Post date:** [January 27, 2012, 1:32pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/9 "2012-01-27T13:32:50Z")

</div>

Have you tried examining the log files?  
Have you tried running your report from iReport (if possible?)

---

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 27, 2012, 1:37pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/10 "2012-01-27T13:37:04Z")

</div>

yeah the log gives me the same error i posted at the begging of the post and from iReport it runs just fine, i also get to see the report from servoy but after that when something else is done on the client or when another client connects it crashes

---

<div class="post-metadata">

**Author:** ![Thomas\_Parry](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Thomas\_Parry](https://forum.servoy.com/u/Thomas_Parry)\
**Post date:** [January 27, 2012, 2:59pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/11 "2012-01-27T14:59:30Z")

</div>

IF you run the report in the developer/debugger and stop it after the report has completed has it crashed then?  
Perhaps you could wrap the plugins.jasperPluginRMI.runReport in a try catch block to determine if there is an exception raised then or if it is a little later in your processing.

Also: have you tried using the latest released plugin version ?

---

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 30, 2012, 1:16pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/12 "2012-01-30T13:16:49Z")

</div>

i put a breakpoint after the report and it didnt crashed by that time, also i didnt get any exception from try catch and im using the 3.1 b2 version of the plugin.  
I realized that the virtualizer is working cause the virtualizer files appeared in the tmp folder, but its still crashing when another client connects or when something else is done. i believe that this problem is just appearing on the server side, cause on developer i havent been able to reproduce the crash.

ive searched ```  
java.lang.OutOfMemoryError: unable to create new native thread

```and
ive changed on the wrapper.config this

```

# Maximum Java Heap Size (in MB)

wrapper.java.maxmemory=128

```auto

and also in the administrator page the client heap size, but nothing seems to work, im kinda lost and confused here <img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" />
```

---

<div class="post-metadata">

**Author:** ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)\
**Post date:** [January 31, 2012, 3:30pm UTC](https://forum.servoy.com/t/out-of-memory-error-in-smart-client/15409/13 "2012-01-31T15:30:20Z")

</div>

ive just solved it!it seems that the server heap was never increased because i didnt reboot the server after modifying the wrapper, i had restarted app server but seems it was not enough.

Now its working fine but im still worried that it might break with some long report and several clients active, anyway i can keep on going now, thanks for the help
