# Out of memory while creating a database with Trig file from commandline

**URL:** <https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663>\
**Category:** Support\
**Created:** [October 31, 2017, 2:21pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663 "2017-10-31T14:21:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicky508](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/nicky508/32/102_2.png) [@nicky508](https://community.stardog.com/u/nicky508)\
**Post date:** [October 31, 2017, 2:21pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663/1 "2017-10-31T14:21:41Z")

</div>

Hi,

We encountered a issue while creating a repository from the commandline and populating it with triples. For a project I developed some stuff locally and put everything in a local repository. After it was completed a exported the repository to a TRIG file an sent it to a remote sever with stardog. The idea was to create a new db and populate it during creation with the TRIG file. However after a couple of minutes stardog returns: “Bulk load was cancelled: java.lang.OutOfMemoryError: Java heap space”. Is there a way for get the bulk upload done, instead of split the TRIG file in parts?

We use Stardog 5.0.4 Enterprise.  
The TRIG file is 914 MB.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [October 31, 2017, 2:40pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663/2 "2017-10-31T14:40:02Z")

</div>

That's not a particularly large amount of data although you didn't mention if the 914MB is compressed which would make a big difference. How many triples are in there? How much memory do you have allocated to Stardog? Are you able to increase the heap space?

You can try setting the memory allocation property `memory.mode` to `bulk_load` [Home | Stardog Documentation Latest](https://www.stardog.com/docs/#_memory_configuration)

---

<div class="post-metadata">

**Author:** ![nicky508](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/nicky508/32/102_2.png) [@nicky508](https://community.stardog.com/u/nicky508)\
**Post date:** [October 31, 2017, 2:56pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663/3 "2017-10-31T14:56:16Z")

</div>

The file is not compressed and contains 9255347 triples. The server has 2 cores with 4 GB memory.  
What would you suggest? Using a compressed version of the file?

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [October 31, 2017, 3:01pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663/4 "2017-10-31T15:01:13Z")

</div>

It’s a good suggestion to change the memory configuration to `bulk_load`. See if it helps (don’t forget to change it back afterwards).

Cheers,  
Pavel

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [October 31, 2017, 3:09pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663/5 "2017-10-31T15:09:46Z")

</div>

Compressing the file won’t help you as far as memory is concerned but it may speed up the bulk load and TRIG should compress a lot depending on the data (possibly as much as 10:1) so uploading it should be much faster as well.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [November 14, 2017, 3:09pm UTC](https://community.stardog.com/t/out-of-memory-while-creating-a-database-with-trig-file-from-commandline/663/6 "2017-11-14T15:09:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
