Does JVM memory management work the same on Windows and Linux? - windows

My original question is that, is this technically rational to check the required heap-size of my Java program on Windows 7, via VisualVM, and come to this conclusion that the program will require the same amount of heap on Linux(RedHat) as well?
I don't know how the system(OS or even CPU and RAM), affect memory management of JVM.
well, the windows is my development system with 4GB of RAM and a Core 2 Due CPU, however the
Linux is the production system with 32GB of RAM and multiple powerfull processors,
Actually, my concern is that the program on Linux might need more memory. less is ok.

Related

How can a 4GB process run on only 2 GB RAM?

Given a 32-bit/64-bit processor can a 4GB process run on 2GB RAM. Will it use virtual memory or it wont run at all?
This is HIGHLY platform dependent. On many 32bit OS's, no single process can ever use more than 2GB of memory, regardless of the physical memory installed or virtual memory allocated.
For example, my work computers use 32bit Linux with PAE (Physical Address Extensions) to allow it to have 16GB of RAM installed. The 2GB per process limit still applies however. Having the extra RAM simply allows me to have more individual processes running. 32bit Windows is the same way.
64bit OS's are more of a mixed bag. 64bit Linux will allow individual processes to map memory well in excess of 32GB (but again, varies from Kernel to Kernel). You will be limited only by the amount of Swap (Linux virtual memory) you have. 64bit Windows is a complete crap shoot. Certain versions will only allow 2GB per process, but most will allow >32GB limited only by the amount of Page File the user has allocated.
Microsoft provides a useful table breaking down the various memory limits on various OS versions/editions. Unfortunately there is no such table that I can find with cursory searching for Linux since it is so fragmented.
Short answer: Depends on the system.
Most 32-bit systems have a limitation of 2GB per process. If your system allows >2GB per process, then we can move on to the next part of your question.
Most modern systems use Virtual Memory. Yet, there are some constrained (and various old) systems that would just run out of space and make you cry. I believe uClinux supports both MMU and MMU-less architectures. Most 32-bit processors have a MMU (a few don't, see ARM Cortex-M0) and a handful of 16-bit or 8-bit have it as well (see Atmel ATtiny13A-MMU and Atari MMU).
Any process that needs more memory than is physically available will require a form of Memory Swap (e.g., a partition or file).
Virtual Memory is divided in pages. At some point, a page reside either in RAM or in Swap. Any attempt to access a memory page that's not loaded in RAM will trigger an interruption called Page Fault, which is handled by the kernel.
A 64-bit process needing 4GB on a 64-bit OS can generally run in 2GB of physical RAM, by using virtual memory, assuming disk swap space is available, but performance will be severely impacted if all of that memory is frequently accessed.
A 32-bit process can't address exactly 4GB of memory in practice (some address space overhead is required by the operating system), so it won't run. Depending on the OS, it can probably run a process that needs > 2GB and < 3-4GB.

Where can I change allocated memory of JDeveloper?

Where can I change allocated memory of JDeveloper? Also Maximum and optimum memory for this IDE. My Machine has a 4GB RAM, I use SOA,BPEL frameworks in that.
Where can I change allocated memory of JDeveloper?
For JDeveloper 11.1.2.x, you can configure VM options in the JDeveloper configuration file at jdeveloper/jdev/bin/jdev.conf. For example, to set the maximum heap size to 2GB, add the following line to this file:
AddVMOption -Xmx2048M
Note that this only affects the IDE - to set memory limits for the internal Weblogic Server, you can set the USER_MEM_ARGS environment variable before launching the IDE, like
$ export USER_MEM_ARGS="-Xms256m -Xmx1024m"
Also Maximum and optimum memory for this IDE
The more, the better. There is no limit besides those imposed by the operating system or the Java virtual machine you are using (32 bit vs. 64 bit).
My Machine has a 4GB RAM, I use SOA,BPEL frameworks in that.
I really suggest that you add more memory. Use a 64 bit operating system and upgrade to at least 8 GB. You need to consider that it is not only the IDE which is consuming memory, but also the internal Weblogic Server, where you are running your application during development. The internal WLS is launched as a separate java process and also consumes a considerable amount of memory.

Automatic Recovery of Virtual Memory Allocation

My system uses a third part kernel built in native libraries (C++) with a J2EE upper layer running on Tomcat 6. The vendor stipulates 32bit JDK and overall the application very memory hungry. We are presently running on Windows x64 with 32 bit JVM. Essentially, the JVM will hang once the Virtual Size gets close to the 2GB 32bit addressing limit.
Question: From time to time, the third party frameworks will make large requests for memory and this pushes up the Virtual Size allocated on the server. The Virtual Size allocated will never recover even though it appears that the memory that the kernel is reducing its memory needs. In a typical Tomcat deployment, does the Virtual Size ever recover automatically or does it always act as a high water level that keeps on rising? Is there a way to tell the JVM to try to lower the Virtual Size dynamically?
I suspect that the 3rd party native kernel is to blame here but I need to investigate all our options.
FYI - AWE in Windows is not a clear option as the vendor does not officially support any JVMs that have AWE support. Migration to Linux is also not an easy path but is being considered.

Simple question: Can x86 apps take advantage of the extra RAM a x64 OS gives?

I hope someone with a bit of knowledge can clear this up. There's many discussions about the reasons to run a 64-bit OS (e.g. Windows 7 x64), but many people seem to think that their old x86 apps will be able to take advantage of any RAM greater than 3.5GB.
As I understand it, though, x86 apps cannot address memory that high... unless they've been specifically programmed to (which very few will have).
Can someone knowledgeable clear this up for me, once and for all? Can 32-bit apps take advantage of a system running 8GB of RAM?
E.g. If a user decided (for whatever reason) to run several x86 apps at once, filling the RAM as much as possible, would the extra addressable memory available in Windows 7 x64 be used?
Thanks!
On a 64 bit system, 32 bit applications are able to use the full 4GB virtual address space, minus about 64K. A default 32 bit windows system will only allow a 32 bit process to use 2 GB of virtual address space. By specially configuring the OS it's possible to push that limit up to 3 GB, but it's still not as good as what you would get on a 64 bit version of windows.
If you have 8GB of ram, that 8 GB can be divided up between multiple 32 bit processes, and the entire 8 GB will be utilized if necessary. However, no single 32 bit process will be allocated more than 4 GB of memory.
Although i don't have sources to cite, but from my knowledge: 32bit app will not be able to address more than 4GB of memory itself, unless it uses some tricks(that is very unlikely), but if you have some 32bit apps running at the same time, they can all have 4GB each, and thus two 32bit apps should be able to use all 8GB of memory. Though I'm not 100% sure.
Yes. x86 apps cannot use more than 2GB of memory at once without special tricks, but they can use any memory available.
Adding to the other (correct) answers:
Instead of the term "application" the word "process" should be used. Applications often consist of multiple processes whereas the limits discussed here apply to single processes.
Thus applications benefit from x64 that either are linked with the LARGEADDRESSAWARE flag (they can use 4 GB instead of 2 GB) or that share the load between multiple processes.
32-bit processes can work with more than 4 GB RAM even on 32-bit systems by using AWE. But a 32-bit process can only ever use 2 GB at once (4 GB with LARGEADDRESSAWARE on 64 bit respectively). AWE is primarily used by databases where it is essential for performance that the entire database fit into RAM. It works by providing a 2 GB window into a larger chunk of memory.
Here are some articles for further reading:
Windows x64 – All the Same Yet Very Different, Part 1: Virtual Memory
Windows x64 – All the Same Yet Very Different, Part 2: Kernel Memory, /3GB, PTEs, (Non-) Paged Pool
x64? My Terminal Servers Run Just Fine With 32 Bits and 8/12/16 GB RAM!
E.g. If a user decided (for whatever
reason) to run several x86 apps at
once, filling the RAM as much as
possible, would the extra addressable
memory available in Windows 7 x64 be
used?
The answer is yes. That's one of the benefits a virtual address space gives us--the ability for each process to appear (to the process) as though it's executing in a linear address space that starts at 0 and goes up from there.
As far as each of the 32-bit applications is concerned, it has its own address space from 0 to 2 gigabytes (without special tricks). The operating system handles the virtual-to-physical address translation.

Visual studio on windows xp

i need to run a few visual studios on windows XP and it seems to take up a lot of memory. i am also running resharper which is a memory hog.
i am running 32 bit XP. How much memory can i put into my machine until i get to the point where the OS hits its limit.
Also, any other ways of running multiple visual studio without such slow performance.
32-bit Operating Systems are limited to 4 GB of RAM, which may or may not be enough for you. Also, I think Windows shows 3 GB of RAM if you install 4 GB.
I suggest you switch to 64-bit and upgrade to 8 GB if you can.
UPDATE: See Jeff's blog post on the subject: Dude, Where's My 4 Gigabytes of RAM?
The maximum amount of memory that can be seen by 32bit WinXP is somewhere between 3 and 4 gigabytes depending on your chipset.
I have also run into issues running multiple instances of VS when I had resharper installed. The only thing you can do is run 64bit XP with more memory, or not use resharper (which is a bummer).
32-bit Windows kernel divides the 4GB virtual addressing space in 2GB/2GB partitions. If you feed the /3GB switch to NTLDR it will offer 1GB kernel space / 3GB user mode space. Note that this NOT implies that you can't write software to take advantage of machines with 32-bit CPUs and address more than 4GB at once.
A workaround is the hardware-supported feature to access the remaining memory in banks or "windows" since the CPU still sees a maximum of 4GB addressable space at once. Some database and GIS software offer this possibility. This is called Physical Address Extensions and allows to use (not addressing at once) up to 64GB with 36-bit addresses. WinXP offers AWE, an API built on top of PAE.
That's the theory. For using Visual Studio you can get the full 4GB for your system or upgrade to a 64-bit OS with more RAM. This only if VS offers a 64-bit version.
"Also, any other ways of running multiple visual studio without such slow performance."
+1 trick: you should use a RAM disk (download) to accelerate I/O.
If you're using - and hopefully do - source-managament system (ie. Subversion), you must just checkout your projects there. VS.NET makes tons of I/O calls, and RAM disks are much faster than real disks.
CAUTION! If you turn off your computer, RAM Disk disappers.

Resources