Some post that are relevant but nothing conclusive:
- Launch sketch with vm arguments
- swap - Java crash due to native memory allocation map failure, despite n - Server Fault
- amazon web services - AWS: There is insufficient memory for the Java Runtime Environment to continue - Stack Overflow
- How to pass arguments to the JVM using Sublime? - Processing 2.x and 3.x Forum
- ** Get command-line parameter in the new world of processing-java - Processing Forum
- ** Possible Memory Leak? - Processing 2.x and 3.x Forum
- Performance and Memory Issues - Processing 2.x and 3.x Forum
- Can't release PImage memory! - Processing 2.x and 3.x Forum
- How do I Increase Java Heap space on Mac? - Processing 2.x and 3.x Forum
I am curious, are you running on BeamStalk or directly on a EC2?
From what I understand, the sketch runs fine with simple images. Can you describe what is a complex case? I am referring to:
Here are some other ideas:
- You need to confirm the issue is memory by using AWS monitoring. I believe you can use CloudWatch.
- Try the image optimization on some of those links I shared above.
- You are using
processing-java --run
. Have you consider exporting your application and calling the exported version?
I am not sure if you can pass memory flags to the jvm using processing-java
. If option 3 above does not work, you can use the source code generated during the export application and build + run your application manually via java
making sure you setup proper resource’s paths. I think I did this a while ago. If you get it to work locally, then you should be able to run the same command in your instance.
Kf