26

Our team makes a software in Java and because of technical reasons we require 1GB of memory for the JVM (with the Xmx switch).
If you don't have enough free memory the app without any sign just exits because the JVM just couldn't bite big enough from the memory.
Many days later and you just stand there without a clue as to why the launcher does nothing.
Then you remember this constraint and start to close every memory heavy app you can think of. (I'm looking at you Chrome) No matter how important those spreadsheets or illustrator files. Congratulation you just freed up 4GB of memory, things should work now! WRONG!
But why you might ask. You see we are using 32-bit version of java because someone in upper management decided that it should run on any machine (even if we only test it on win 7 and high sierra) and 32 is smaller than 64 so it must be downwards compatible! we should use it! Yes, in 2019 we use 32-bit java because some lunatic might want to run our software on a Windows XP 32-bit OS. But why is this so much of a problem?
Well.. the 32-bit version of Java requires CONTIGUOUS FREE SPACE IN MEMORY TO EVEN START... AND WE ARE REQUESTING ONE GIGABYTE!!
So you can shove your swap and closed applications up your ass but I bet you that you won't get 1GB contiguous memory that way!
Now there will be a meeting about this issue and another related to the issues with 32-bit JVM tomorrow. The only problem is that this issue only occures if you used up most of your memory and then try to open our software. So upper management will probably deem this issue minor and won't allow us to upgrade to 64-bit... in 20fucking19

Comments
  • 3
    Run! Run fast! Don't look back!
  • 1
    1GB of RAM...? for what?
  • 0
    Best part is that this should be our rewrite, a version 2, because the first one was bloated and had too much tech debt.
  • 1
    @Krokoklemme I dont really remember what was the one feature that required close to 1gb but its a device updater so it searches and list hundreds of ethernet and usb devices found via bonjour and hid api and sends them firmware and software packages over different protocols. one of them is even our proprietary protocol. Also backs up and restores presets and settings.
  • 3
    I always felt like Java is the most memory hungry language in general. That feeling getting stronger everyday...
  • 0
    Standard Jre installation is 32bit unless you expressly search for and install 64bit.
  • 1
    @TMBSTruth we bundle a specific version of jre next to the program and the .exe execitable starts the app with the bundled jre in order to get around the fact that the installed version might not be the right version or there might be no installation at all.
  • 1
    @soulevans07 oh that makes sense now, thanks for clarifying.
  • 0
    Sorry, but your rant is wrong. Continuous addressable process memory doesn’t mean contiguous physical memory. The operating system should be able to configure virtual memory for JVM from free physical+swap space, however it’s fragmented.

    Also, -Xmx=1G means that the process will use more than 1GB, Xmx is only about the heap.
  • 0
    @matste I never said it needs to be physical memory, only that if its fragmented the JVM couldnt start because it couldnt allocate enough memory. Yeah, the system should be able to reorganize the virtual memory on JVM start in my opinion too but it just does not do it. Well at least not on starting the JVM. If you wait around, start and close other programs but always keep 1gb memory free, after a while it changes it's mind and start as it should so I assume the OS organized the virtual memory over time and not on demand.
    And yes, Xmx only specifies heap, but the JVM only complained about not being able to allocate the specified heap from memory.
Add Comment