28

I have a .sql file with size 1047399KB,I'm trying to run it on Windows10 with 4.00GB RAM on DBeaver program, i got java.lang.OutOfMemoryError: Java heap space error

I tried many solutions but didn't work with me. file.sql -Xms128m -Xmx512m, file.sql -vmargs -Xmx1024M, file.sql -Xmx800m -Xms500m all didn't work with me.

Zeyad Etman
  • 2,250
  • 5
  • 25
  • 42
  • All depends on the underlining java application implementation. If it trys to load the whole file before process it, you have to allocate at least 2GB of memory – Maxim Sep 20 '18 at 12:49
  • 1
    You may also have luck modifying the dbeaver.ini file to increase the heap size. – eebbesen Feb 13 '20 at 05:34
  • @ZeyadEtman : As per https://dbeaver.io/forum/viewtopic.php?f=2&t=1162. We can set max memory to 1GB. I tried with 2048 and 4096 but same issue faced. But when I tried with "-vmargs -Xmx1024m" it works well. – Abhishek Nov 29 '21 at 11:15
  • @Raedwald It's a question about DBeaver, not Java. This is not a duplicate. – vintprox Aug 30 '22 at 18:13
  • @vintproxvintpro the accepted answer indicates it is a duplicate – Raedwald Aug 31 '22 at 06:59
  • @Raedwald not really. My answer just points to DBeaver's forum. "Duplicates" provided above don't relate to DBeaver other than by a long shot. – vintprox Oct 13 '22 at 19:25

1 Answers1

46

I encountered same issue: every time you get it, you have to allocate more space and run DBeaver itself first with additional flags -vmargs -Xmx*m. Replace * with 2048 or 4096.

It doesn't look like DBeaver takes garbage out when closing the script, so I had to restart application many times to check right amount of memory needed.

@Timothy Jannace just pointed out that you also can edit dbeaver.ini. Example.

vintprox
  • 931
  • 1
  • 11
  • 24
  • 1
    Thanks this solved my problem! It's a bit worrying that a test of `SELECT * FROM LEFT JOIN` for a small database actually takes around 2GB ram. – Nicholas Humphrey Apr 30 '19 at 12:40
  • 1
    @NicholasHumphrey Well, I noticed phpMyAdmin comes in handy for import task, for example, better than DBeaver and HeidiSQL. I was assuming that native software must provide more seamless experience and overtake memory limits of web application, but it's not the case with specific, database software, I guess. – vintprox May 01 '19 at 12:57
  • 1
    I tried 1Crore data to important one DB to another DB but the tool is not responding. Then I have increased memory parameters in ".ini" file after that it's successfully imported. Hope it's helpful for someone. – GIRI KUMAR PANEM Mar 04 '20 at 14:30
  • 2
    can someone explain how to run DBeaver from command line? I am using Mac OS version. It seems it is an .app file – cryanbhu May 20 '20 at 05:45
  • 1
    Try editing the values in the ini file instead. You should be able to find the file in the program directory of dbeaver. It should be called dbeaver.ini – Timothy Jannace Nov 24 '20 at 19:27
  • 8
    @cryanbhu edit `dbeaver.ini` file as shown [here](https://gist.github.com/souhaiebtar/9bc22ff3eafbba1542b5c05a70228a02). Path should be something like `/Applications/DBeaverEE.app/Contents/Eclipse/dbeaver.ini`. – vintprox Nov 24 '20 at 20:45
  • 1
    I changed two parameters on my dbeaver.ini file: -Xms500m -Xmx4096m worked for me – Joao Vitor Deon May 03 '22 at 15:04
  • 3
    3 years later and this still works like a charm to prevent OOM exceptions. The provided example link lists the typical paths, for non-standard in stalls the comment section on the gist is extremely helpful – RivenSkaye Oct 13 '22 at 06:25
  • 1
    @RivenSkaye yeah no shit, this one still blinks in my notifications every month xD – vintprox Oct 13 '22 at 19:21
  • 1
    In Linux Mints its located here: /usr/share/dbeaver-ce – ii iml0sto1 Jan 04 '23 at 22:09