# Out of memory - Gateway on Windows

**URL:** <https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808>\
**Category:** Ignition\
**Created:** [July 17, 2017, 12:47pm UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808 "2017-07-17T12:47:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [July 17, 2017, 12:47pm UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/1 "2017-07-17T12:47:43Z")

</div>

Hello,

i am experiencing periodical gateway crashes caused by memory problems on 32bit windows. The problem is not the java heap memory but the native windows memory. At a certain point the gateway process is not able to get any more heap memory from windows, so creation of new java threads or malloc in native libraries (stack trace below) fails.  
When i watch the memory allocation with VMMap, i can see that heap memory usage is constantly increasing up to about 1.6G when the gateway starts to fail.  
My prime suspect is the SQLite library since it seems to allocate lots of native heap memory. I am not exactly sure when the problem occcured first, but it might have been together with the change of Ignitions internal db.

Is this a known problem or does anybody know a solution?

```auto
INFO | jvm 7 | 2017/07/17 13:40:13 | Caused by: java.sql.SQLException: [SQLITE_NOMEM] A malloc() failed (out of memory)
INFO | jvm 7 | 2017/07/17 13:40:13 | at org.sqlite.core.DB.newSQLException(DB.java:890)
INFO | jvm 7 | 2017/07/17 13:40:13 | at org.sqlite.core.DB.newSQLException(DB.java:901)
INFO | jvm 7 | 2017/07/17 13:40:13 | at org.sqlite.core.DB.execute(DB.java:810)
INFO | jvm 7 | 2017/07/17 13:40:13 | at org.sqlite.jdbc3.JDBC3PreparedStatement.executeQuery(JDBC3PreparedStatement.java:68)
INFO | jvm 7 | 2017/07/17 13:40:13 | at com.inductiveautomation.ignition.gateway.localdb.DelegatingDataSource$DelegatingConnection$DelegatingPreparedStatement.executeQuery(DelegatingDataSource.java:574)
INFO | jvm 7 | 2017/07/17 13:40:13 | at simpleorm.sessionjdbc.SQueryExecute.executeQuery(SQueryExecute.java:61)
INFO | jvm 7 | 2017/07/17 13:40:13 | ... 32 more

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 17, 2017, 12:56pm UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/2 "2017-07-17T12:56:59Z")

</div>

What version of Ignition is this happening on?

---

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [July 17, 2017, 1:03pm UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/3 "2017-07-17T13:03:36Z")

</div>

Oh, sorry. It began with 7.7.something, the current version is 7.8.5. OS is Windows 7, 32bit in a VM.

---

<div class="post-metadata">

**Author:** ![mgross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mgross/32/3311_2.png) [@mgross](https://forum.inductiveautomation.com/u/mgross)\
**Post date:** [July 17, 2017, 2:15pm UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/4 "2017-07-17T14:15:53Z")

</div>

If you can get the JDK installed on that box, you could also run jmap to get a .hprof heap dump. I know you said the problem was in the OS memory, but there may be some long-lived objects that are also hanging onto native memory. They may show up in the .hprof file.

---

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [July 20, 2017, 11:25am UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/5 "2017-07-20T11:25:20Z")

</div>

The JDK is already installed, i made some heap dumps when the problem started but could not find anything unsual there.  
The Ignition service restarted two days ago (i am using a trigger in the wrapper.conf on OutOfMemory exceptions). I made a heap dump immediately after the restart and two times a day since then. At the same time, i recorded the Windows memory footprint. You can see that the private data (Java heap) stays constant but the windows heap is continously increasing.  
The zip file in [this link](https://drive.google.com/file/d/0B2jQQ7BhLXDnWndsOXRwUUxnWFU/view?usp=sharing) contains two heap dumps, one directly after the restart, the second one from two days later. Maybe you can find something that i missed.  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/28a4efd720b39d70be0b3340305d9107c17f67ad.jpg)

---

<div class="post-metadata">

**Author:** ![mgross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mgross/32/3311_2.png) [@mgross](https://forum.inductiveautomation.com/u/mgross)\
**Post date:** [July 20, 2017, 3:47pm UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/6 "2017-07-20T15:47:26Z")

</div>

Yeah the heap dumps didn’t have any obvious problems. It looks like this gateway is running reports though. Can you try disabling report execution for a period of time to see whether the reports are causing the memory spikes?

---

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [July 26, 2017, 10:37am UTC](https://forum.inductiveautomation.com/t/out-of-memory-gateway-on-windows/14808/7 "2017-07-26T10:37:40Z")

</div>

Disabling the project with the reports had no effect. In addition i uninstalled the reporting module and restarted the Gateway. The increase of memory usage was the same, so reporting is not the problem here.  
Any other ideas?
