# out of memory error for Servoy 2.2.4

**URL:** https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946
**Category:** Classic Servoy
**Created:** [January 11, 2007, 2:17am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946 "2007-01-11T02:17:33Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 11, 2007, 2:17am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/1 "2007-01-11T02:17:33Z")

</div>

Hi there,

Our Servoy Apps server was running fine for a few days until we hit a “out of memory” error. None of the clients are able to connect. Our server has over 2 gigs of memory.

I’ve attached a screenshot of our servoy apps setting as well as our server memory available screen.  
The log file also logged the issue and is attached.

Servoyians, please help!

Thanks,  
sammy

Settings:

Server Information  
Servoy version R2 2.2.4-build 336, repository version 27  
java.vm.version=1.4.2\_05-b04  
os.name=Windows 2000  
Running MS SQL server 2000

[servoy\_out of memory.doc](https://forum.servoy.com/uploads/short-url/gk6B0M68wu5APWedi9ToCf3fCfv.doc) (217 KB)

[servoy-outofmemory.txt](https://forum.servoy.com/uploads/short-url/yeImJuhniFwUM04XyNsVKtJCRDl.txt) (175 KB)

---

<div class="post-metadata">

### Author: ![svroemisse](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@svroemisse](https://forum.servoy.com/u/svroemisse)
#### Post date: [January 11, 2007, 7:49am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/2 "2007-01-11T07:49:55Z")

</div>

> sammyzheng:  
> Hi there,
> 
> Our Servoy Apps server was running fine for a few days until we hit a “out of memory” error. None of the clients are able to connect. Our server has over 2 gigs of memory.

By default, Java will only use a maximum of 64 megabytes. In Servoy 2.2, the default is used. You can either upgrade to Servoy 3 or change the servoy\_server.bat file that you use to start the server.

This is how to change the .bat file: open in an editor (notepad would do) and find the line that starts with ‘java’. Add ‘-Xmx256m -Xms64m’ right after ‘java’ so you get:

```auto
java -Xmx256m -Xms64m -Djava.awt.headless=true -classpath (and then a lot more stuff)

```

Save the file and restart Servoy Server. Now Servoy Server will use up to 256 megabytes of memory.

---

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 11, 2007, 4:29pm UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/3 "2007-01-11T16:29:54Z")

</div>

Thanks for the tip: Since this is a production environement, i’ll have to wait until weekend to restart the server. Upgrade to 3.0 is not an option for us right now.  
Couple more questions.

1. Can we do it directly in the servoy web-admin page?
2. How do we know we’ve changed it successfully? Is there some indicator?

---

<div class="post-metadata">

### Author: ![svroemisse](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@svroemisse](https://forum.servoy.com/u/svroemisse)
#### Post date: [January 12, 2007, 1:59pm UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/4 "2007-01-12T13:59:25Z")

</div>

> sammyzheng:  
> Couple more questions.
> 
> 1. Can we do it directly in the servoy web-admin page?
> 2. How do we know we’ve changed it successfully? Is there some indicator?

1. No, unfortunately you cannot change it in the web-admin page. You’ll have to edit the .bat file manually.

2. In the web-admin page entry screen, Servoy Server shows the amount of memory used. If it’s greater than 64MB, it worked. If it isn’t, unfortunately all you know is it doesn’t need that much at the moment. You could launch some clients of course, to see if you can get it past that 64 meg boundary.

---

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 13, 2007, 3:19am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/5 "2007-01-13T03:19:54Z")

</div>

which exact screen am I supposed to see the 64MEG upgraded to 256Meg? is it the "servoy.maxClientHeap: " . I tried doing what you said  
to add the -Xmx256m -Xms64m to the java line, but it still says 64 meg on the maxclient heap?

below is my servoy\_server.bat file txt

@echo off

:restart  
rem To enable logging change ‘java’ into ‘java -DSTACKTRACE=true’  
java -Xmx256m -Xms64m -Djava.awt.headless=true -classpath .;lib\commons-collections.jar;lib\commons-dbcp.jar;lib\commons-pool.jar;lib\activation.jar;lib\antlr.jar;lib\j2db.jar;lib\j2dbdev.jar;lib\compat141.jar;lib\jndi.jar;lib\js.jar;lib\jta.jar;lib\mail.jar;lib\jug.jar;lib\jdbc2\_0-stdext.jar;lib\naming-common.jar;lib\naming-resources.jar;lib\servlet.jar;lib\xerces.jar;lib\server-bootstrap.jar;lib\commons-fileupload-1.0.jar;lib\commons-logging.jar;lib\hibernate2.jar com.servoy.j2db.server.ApplicationServer %1 %2 %3 %4 %5 %6 %7 %8 %9

rem loaded by tomcat it self: server\lib\catalina.jar;server\lib\jakarta-regexp-1.2.jar;server\lib\jasper-compiler.jar;server\lib\jasper-runtime.jar;server\lib\naming-factory.jar;server\lib\servlets-common.jar;server\lib\servlets-default.jar;server\lib\servlets-invoker.jar;server\lib\servlets-manager.jar;server\lib\servlets-snoop.jar;server\lib\servlets-webdav.jar;server\lib\tomcat-ajp.jar;server\lib\tomcat-util.jar;server\lib\warp.jar

rem restart if the server exited with the restart exit code 99  
if errorlevel 99 goto restart

---

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 13, 2007, 8:10am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/6 "2007-01-13T08:10:59Z")

</div>

This problem occured twice(before I put in the -Xmx256m code)

I’m still unsure how we can verify that my fix works and increased the servoy Apps server to use more than 64 megs of ram? I cannot afford another “crash” and halt my production environment again. I’m under some great pressure here…

I’m only talking about having 50 concurrent users on a Dual CPU 2 gig of ram Windows 2000 server. We have plans to roll out to 100 users eventually. How can we get these “out of memory” errors??? aren’t servoy server built to handle large client base?

---

<div class="post-metadata">

### Author: ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)
#### Post date: [January 13, 2007, 8:37am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/7 "2007-01-13T08:37:03Z")

</div>

Hi sammy,

here you see how much memory Servoy server is using.  
if you start the server (as you mentioned) with the extra options, the allocated and used memory will automaticly grow.

As Sander said, you can only see that, if the memory grows. not instantly.

Hope this helps.

![mem.GIF](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/e/e6a389813072c203c9b98d6d45bfe6fb2cc4f4dc.gif)

---

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 13, 2007, 9:03am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/8 "2007-01-13T09:03:31Z")

</div>

> HJK:  
> Hi sammy,
> 
> here you see how much memory Servoy server is using.  
> if you start the server (as you mentioned) with the extra options, the allocated and used memory will automaticly grow.
> 
> As Sander said, you can only see that, if the memory grows. not instantly.
> 
> Hope this helps.

Hi there HJK,  
1)I’m using servoy 2.2.4; I know that on servoy 3.0, it shows that statistic, but on 2.2.4, it doesn’t on the web-admin page. Is there a way I can confirm since I have the lower version? I just can’t afford to wait until another “out of memory” crash again.

2)Also, are you saying that with this code: “java -Xmx256m -Xms64m -Djava.awt.headless=true” in place, the memroy allocation will automatically take care of it self? Why wouldn’t it be a default for servoy apps server.

Sorry for these silly quesitons, but I just want to make sure and get a confirmation that my code was started properly.

Thanks all,  
sammy

---

<div class="post-metadata">

### Author: ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)
#### Post date: [January 13, 2007, 9:16am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/9 "2007-01-13T09:16:54Z")

</div>

the screenshot you saw is from servoy 2.2.7  
So I think you can’t see it, but have to trust that is works.

---

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 13, 2007, 5:38pm UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/10 "2007-01-13T17:38:48Z")

</div>

One more question, When I changed the servoy\_server.bat file, do I have to double-click on the servoy\_server.bat file to run it? or is simply starting and restarting the service using Windows Service or Web-admin tool enough to make the change effective?

I really wish there was a way to verify the memory check worked. If this happens again, I’ll have a lot of explaning to do

---

<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 13, 2007, 6:01pm UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/11 "2007-01-13T18:01:59Z")

</div>

> sammyzheng:  
> One more question, When I changed the servoy\_server.bat file, do I have to double-click on the servoy\_server.bat file to run it? or is simply starting and restarting the service using Windows Service or Web-admin tool enough to make the change effective?

Restarting Servoy server is enough.

---

<div class="post-metadata">

### Author: ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)
#### Post date: [January 13, 2007, 7:01pm UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/12 "2007-01-13T19:01:05Z")

</div>

oh wait, you are starting the server by the windows services?  
than the bat-file will do nothing for you!!!

than you must search for a file: wrapper.conf in the service folder

search for this:

```auto
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=256

```

adjust the maximum java heap size for your needs

than restart the server.

hope that helps

---

<div class="post-metadata">

### Author: ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)
#### Post date: [January 14, 2007, 1:53am UTC](https://forum.servoy.com/t/out-of-memory-error-for-servoy-2-2-4/6946/13 "2007-01-14T01:53:49Z")

</div>

HJK. THANKS so much for the information! that’s exactly what I needed to know.

Do you know also know if 512MB RAM max on server is enough to support about 70-100 total concurrent clients?

I’ve also changed the servoy.maxClientHeap: to 128 from 64 per Bob Cusick’s instructions.

hopefully doing both things will really address the out of memory error.

You guys are great!
