Is there a memory-efficient replacement of java.lang.String?

With a Little Bit of Help From the JVM… WARNING: This solution is now obsolete in newer Java SE versions. See other ad-hoc solutions further below. If you use an HotSpot JVM, since Java 6 update 21, you can use this command-line option: -XX:+UseCompressedStrings The JVM Options page reads: Use a byte[] for Strings which … Read more

How can I check the memory usage of objects in iPython?

Unfortunately this is not possible, but there are a number of ways of approximating the answer: for very simple objects (e.g. ints, strings, floats, doubles) which are represented more or less as simple C-language types you can simply calculate the number of bytes as with John Mulder’s solution. For more complex objects a good approximation … Read more

If I set only a high index in an array, does it waste memory?

See this topic: are-javascript-arrays-sparse In most implementations of Javascript (probably all modern ones) arrays are sparse. That means no, it’s not going to allocate memory up to the maximum index. If it’s anything like a Lua implementation there is actually an internal array and dictionary. Densely populated parts from the starting index will be stored … Read more

How to assign more memory to Netbeans?

In the etc directory under your Netbeans-Home, edit the file netbeans.conf file. -Xms and -Xmx should be increased to the values that allow your program to compile. Here are the instructions in netbeans.conf: # Note that default -Xmx and -XX:MaxPermSize are selected for you automatically. # You can find these values in var/log/messages.log file in … Read more

What is ‘PermSize’ in Java?

A quick definition of the “permanent generation”: “The permanent generation is used to hold reflective data of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations.” [ref] In other words, this is where class definitions … Read more