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

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

Yes, it does currently build up a DOM object and then serialize it out.    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.  I would guess it is going to be non-trivial to handle.  It will be easier with the CSV output than output since you can stream to the file better and/or use scrollable result sets. 

Nathan

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

So you’re close :) 

It definitely does need some memory improvements. 

Nathan

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.