# "OutOfMemoryError: Java heap space" when running with diffTypes=data

**URL:** <https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828>\
**Category:** General Discussion\
**Created:** [October 1, 2010, 5:55pm UTC](https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828 "2010-10-01T17:55:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jens\_neuhalfen](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jens\_neuhalfen](https://forum.liquibase.org/u/jens_neuhalfen)\
**Post date:** [October 1, 2010, 5:55pm UTC](https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828/1 "2010-10-01T17:55:00Z")

</div>

Hi there,

I am trying to create a changelog containing a “dump” of a database, and always receive OutOfMemoryErrors. This even happens when I run liquibase with Xmx=5g!

The DB itself is not very large (an uncompressed SQL-Dump [MySQL] is about 156MB, and contains about 1 million records).

I get the impression, that liquibase builds a DOM in memory and chokes, but cannot confirm this.

What can I do to make the dump work? How can I assist to resolve this issue?

Btw: I am using 2.0 RC5.

Jens

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [October 1, 2010, 5:55pm UTC](https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828/2 "2010-10-01T17:55:00Z")

</div>

Yes, it does currently build up a DOM object and then serialize it out.&nbsp; &nbsp; If yoru database is not large, you may be able to increase the java heap size with the -Xmx JVM flag and be fine.

If you are wanting to look the code, it is in the liquibase.diff.DiffResult class in the liquibase 2.0 codebase.&nbsp; I would guess it is going to be non-trivial to handle.&nbsp; It will be easier with the CSV output than output since you can stream to the file better and/or use scrollable result sets.&nbsp;

Nathan

---

<div class="post-metadata">

**Author:** ![jens\_neuhalfen](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jens\_neuhalfen](https://forum.liquibase.org/u/jens_neuhalfen)\
**Post date:** [October 1, 2010, 5:55pm UTC](https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828/3 "2010-10-01T17:55:00Z")

</div>

Nathan,

increasing the memory limit did not help that much: With 5 GiB of Xmx java still OOMes. I removed a few ten thousand of db rows and the export ran smoothly.

Regards  
Jens

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [October 1, 2010, 5:55pm UTC](https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828/4 "2010-10-01T17:55:00Z")

</div>

So you’re close :)&nbsp;

It definitely does need some memory improvements.&nbsp;

Nathan

---

<div class="post-metadata">

**Author:** ![AR036](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@AR036](https://forum.liquibase.org/u/AR036)\
**Post date:** [May 6, 2021, 4:19pm UTC](https://forum.liquibase.org/t/outofmemoryerror-java-heap-space-when-running-with-difftypes-data/828/5 "2021-05-06T16:19:28Z")

</div>

This issue is also seen in liquibase version 4.2.0 when used with maven.

I am unable to export data even for a single table that has 10 records.

I did profiling and found there’s a memory leakage.  
Details of issue can be found below.

> [@OOM Exception, while data export using maven plugin](https://forum.liquibase.org/t/oom-exception-while-data-export-using-maven-plugin/5430):
>
> I am getting an exception while exporting the data from Oracle database using Liquibase. I have used below maven command mvn -e -X liquibase:generateChangeLog -Dliquibase.diffTypes=data -DargLine= "-Xms10G -XmX 20G -XX:-UseGCOverheadLimit" last line I can see in the log before failing is, [DEBUG] Executing with the ‘jdbc’ executor When I checked the same in Java Visual VM, I found that liquibase.change.ColumnConfig class is consuming 80% of space, this is more likely a memory leakage issue. …
