Testing heap size on HP UX with jdk 1.5 64bits

Is three a limit in the heap size for HP UX jdk1.5?

-No, according to this test:

/opt/java1.5/bin/IA64W/java -d64 -Xms256m -Xmx8000m -jar memtest.jar MemTest
(c)jmu | mar 2016 | A simple test program
Creating a byte[] of 3145728 bytes size
A small piece of the array:
Sleeping 30 secs

Source code:

package memtest;
 public class MemTest {
    public MemTest() {
 public static void main(String[] args) {
        MemTest memTest = new MemTest();
        System.out.println("(c)jmu | mar 2016 | A simple test program");
        int bytes = 3*1024*1024;
        byte[] cosa = new byte[bytes];
        System.out.println("Creating a byte[] of " + (bytes) + " bytes size");
        String s = new String(new char[bytes]).replace("\0", "h");
        cosa = s.getBytes();
        System.out.println("A small piece of the array:");
        System.out.println(s.substring(9, 19));
        System.out.println("Sleeping 30 secs");
        try{Thread.sleep(30000);}catch(Exception e){e.printStackTrace(System.out);}


Enjoy 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.