why are simple java programs using up so much space

this is the link to simple input of a string using console and printing its tength.it used up 245632kb.why?

1 Like

I’m pretty sure it’s because of the Java Virtual Machine that has to be loaded into memory for a java program to execute. Someone more knowledgeable can probably elaborate on this though.

java load all the necessary runtime classes in PermGen area. A default initial heap size will be allocated to run the java program. As the memory requirement increases , the heap expands to a maximum value which can be specified using JVM arguments.Hence It takes memory to load classes and allocating default heap.