Clojure STM out of memory

I have a small program that needs to do parallel bank transfer using STM, so I am testing it on different machines, dual core and single core. On dual core machines, everything works, but on a 1 core machine, the Java Out of Memory error occurs when I execute 1 million concurrent transactions.

The error is the following "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

Also I have a Java version of the synchronization of the same program that works, even if it is slower, it can go up to a million transactions.

What can I do to make a Clojure application work on a 1-core machine? I'm afraid the garbage collector can't handle that many Refs ... what do you think?

Many thanks for your help!

Update: Now it works, I did java -Xmx1000m -jar myprog.jar

and works great!

I didn't know it was possible to increase the heap size for the JVM and that was my problem. Many thanks to "sw1nn" for the great comment;)

+3


source to share


1 answer


You can also add jvm-opts to your leiningen project.clj like below:

:jvm-opts ["-Xmx1500m"]

      



to define it when you run your program in leiningen (like testing)

+2


source







All Articles