12
Pickman
5y

My boss just now: "In a 32 bit machine the memory limit is 1.6 GB. After that programs routinely crash."

What really happens IMO? He writes programs that crash when they reach 1.6 GB allocated and the architecture is 32 bit. But it's a limit of his software, not one of the OS.

Comments
  • 6
    Is he writing dotnet code?

    I remember reading somewhere that on 32 bit systems the OutOfMemoryException happen when usage reaches 1.6GB

    I'll go double check and be back 😊
  • 6
    Found this:

    Your app runs as a 32-bit process.

    32-bit processes can allocate a maximum of 2GB of virtual user-mode memory on 32-bit systems, and 4GB of virtual user-mode memory on 64-bit systems. This can make it more difficult for the common language runtime to allocate sufficient contiguous memory when a large allocation is needed. In contrast, 64-bit processes can allocate up to 8TB of virtual memory. To address this exception, recompile your app to target a 64-bit platform.

    So basically, he is kind of right and if you want that sweet 8TB max limit, you need to compile the exe to 64bit.
  • 1
    Forgot to mention. There is a chance your app might crash before reaching the 2gb max on 32bit if your app's allocated memory became fragmented. It is a fucked up shit to debug and fix but quite possible.

    Can you confirm if he is doing dotnet?
  • 3
    No, it's Java. I have no idea what he did. He has a tendency to overcomplicate things. Right now he's fighting with a curtain. The curtain seems to be winning.
  • 2
    @Pickman I don't know much about Java but I suspected the JVM will behave similarly to the CLR in terms of memory limits.. I was right:

    "The maximum theoretical heap limit for the 32-bit JVM is 4G. Due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower. On most modern 32-bit Windows systems the maximum heap size will range from 1.4G to 1.6G. On 32-bit Solaris kernels the address space is limited to 2G. On 64-bit operating systems running the 32-bit VM, the max heap size can be higher, approaching 4G on many Solaris systems."

    So technically, he is reaching the max (1.3 or 1.4) and the app crashes...

    Tell him to compile to 64bit or find a memory profiler and fix the memory leak.
  • 0
    Typical service desk explanation 😁
  • 0
    @MrCSharp there is no memory leak. He's just using a lot of data. However another developer managed to create similar applications with 3GB allocated on the same machine. There's something fishy going on.
  • 0
    My question is why is he doing it that way? In what possible use case do you need 32 bit AND over 1.5GB of ram? There's really no reason to write 32 bit code anymore imo except integrated or small platforms. And with 32 bit's 4GB limit, taking into account the OS probably needs a few hundred mb, it's trying to allocate nearly half of the available ram!
Add Comment