So, I have a java jar to run on my raspberry pi, and it requires a lot of memory. I have set up 2 gb swap on an external usb flash drive. But when I start the jar with -Xmx2048M, it says that it could not reserve enough space for 2097152KB object heap. I know this is a bad idea, but I want to do it anyway. How do I go about making java recognize the swap as heap space?
Make java understand that swap exists, and encourage him to use it
508 Views Asked by James B. Reese At
1
There are 1 best solutions below
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in RASPBERRY-PI
- Raspberry Pi Sense Hat with Pyinstaller
- Waiting for several hours before resuming execution
- Using compositor in Gstreamer to merge imagesequence with video/audio stream
- How to make this sensor keep taking readings once its when_in_range function has been activated?
- Emulating an HID device with a raspberry pi 5
- How to stream PCM audio to a speakers both on mac and linux in Node.js?
- I want to use NRF24L01 transceiver with raspberry pi but some GPIO pins are already occupied by 3.5 inch display how do i connect transceiver
- voron 2.4 mainsail kiauh error install crowsnest (solved problem)
- Pi4J minimal example's LED doesn't blink
- How can I connect and send data from react-native to raspberry pi
- Xpt 2046 Display with Pn532 RFID reader
- Google SDK for Raspberry pi
- How to use a RaspberryPi camera with the cv2.videoCapture() function?
- How do I capture audio from the system bus in a node app (or from sox) on a raspberry pi?
- Can't open /dev/mem: Operation not permitted Raspberry Pi
Related Questions in HEAP-MEMORY
- Why can I not increase my Java heap space?
- How to throw an error when a program acesses a block of memory created by you that has been deallocated by a call of free?
- Does CLR add overhead fields to type which value is null?
- ApplicationInsights high memory usage
- Why does process memory grow in .Net, but managed heap size does not change?
- Javascript heap memory
- corruption memory on heap only when using one specific function
- Why when I reserve less memory in assembly .bss section it doesn't segfault until I reserve 0?
- Security scan flagged local variable for heap inspection in C Function
- Breadth First Search Causing Heap Memory Error With exponentially growing graph
- pointers from heap and instances from stack C++
- Tomcat memory utilization on Docker Containers
- How to read large file and avoid java.lang.OutOfMemoryError?
- how to return an array of struct pointers?
- Unsure how to declare and then access an int array in heap memory
Related Questions in RAM
- Windows 64-bit: Do overlapped MMF windows mean more RAM consumption (doubling the RAM where the file views overlap)?
- Read/write data to DS1642
- Failed to use memory bits in fpga
- Is it better to pass a C++ object by reference than by value if it is in RAM?
- Stm32 Problem with reading from Flash memory (incorrect data)
- MariaDB not releasing RAM after jobs finish
- How to secure a Python project on Windows from domain administrators?
- Memory consumption of Parent & child process in Linux
- Simulation contradiction using the same Vivado block ram IP
- RAM crash executing procedure in Spyder
- Will the 16n prefetch in DDR5 affect the bandwidth of small-granularity memory accesses?
- How do I view individual memory blocks on my PC?
- pidstat output to file, once
- Get memory usage of this process C++ Win32
- how do I determine how much RAM a jupyter notebook has allocated and is using?
Related Questions in SWAPFILE
- Why did Vim create a constantly growing .swp file?
- Custom Node Configuration in AKS using Terraform
- Error writing lock file: Permission denied
- Where accessing swap space is handled in Linux kernel?
- How to make use of swap space on disk when run out of modern gpu memory?
- How To implement swapfile cross operating system
- I need docker instance to NOT utilize the host swap
- Make a copy of swapfile.sys to new location [File not found error]
- Can I create an array exceeding RAM, if I have enough swap memory?
- How to get vim to list the PIDs of selected files that are presently being edited, avoiding recovery mode, and not list all the other files
- How to create swap partition/file on a Yocto distribution
- Move REDIS data between memory and disk
- R eats up all RAM, then all swap, and the suddenly closes
- Is there a way to force a hard RAM-usage limit for R, resulting in it using swap space after it is hit?
- configuring a swap space in a guest running under qemu
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Java doesn't know about swap space. It just asks the OS for "more memory", and the OS says "yes" or "no" depending on what is still available.
Swap space is configured at the Raspberry Pi operating system level; see How to set up swap space for details.
But have you tried the normal things?
-XmxJVM command line option to set the Java heap size1. (Seeman javafor the details.)man ulimitfor the details.)1 - This is not "telling it to use swap". It is telling Java to set the maximum heap size to a value that is different to the default max heap size.
UPDATE - I see from a comment that you know about the -Xmx option, and are presumably using it. So that leaves one more thing. Since you are using a 32-bit JVM on a 32-bit OS, there is a architectural limit on the JVM's total memory usage. The limit will be less than 4 GB ... all up. (According to this, the limit is 3.6 GB or thereabouts, though I am not convinced that is accurate.)
If you are running up against that limit, there is nothing you can do about it, I'm afraid.
You say:
What is the complete error / exception message?
Well, if you literally need more RAM, you need to buy a Raspberry Pi with more RAM. (Apparently, there aren't any supported options for expanding the RAM on an existing Pi.)
Increasing the RAM and increasing the available virtual memory are NOT the same thing ...
Note that if you size a JVM's heap to be larger than the available RAM, you are liable to run into problems with thrashing when the JVM does a full garbage collection.