xingbin
xingbin

Reputation: 28269

Understanding footprint measurement in java garbage collection

I'm trying to understand java garbage collection. There are four measurement in garbage collection mentioned here:

Footprint is the working set of a process, measured in pages and cache lines. On systems with limited physical memory or many processes, footprint may dictate scalability.

I can understand the other three, but what exactly is Footprint and how to optimize it?

Upvotes: 5

Views: 1018

Answers (2)

Gab
Gab

Reputation: 8323

Footprint is the amount of memory allocated by a process.

Optimizing it means storing less things in memory for less time (don't load what you don't need, free memory as soon as possible ie. dont keep reference on no more used variable).

Reducing footprint may come with an additional overhead in CPU or other IO (memory is quick to access much more than file system or network).

You can also reduce the whole java process footpting by limiting the maxmimum amount of memory allocated (-Xmx JVM option) however working with few memory will trigger more (more often and longer) garbage collector calls and will so use more CPU).

A good example of footprint reduction would be processing an XML tree using a pull parser (parse the tree chunk by chunck) instead of DOM (load the whole tree in memory to process it)

Upvotes: 4

Dina Bogdan
Dina Bogdan

Reputation: 4698

Memory footprint refers to the amount of main memory that a program uses or references while running. Larger programs have larger memory footprints. An application's memory footprint is roughly proportionate to the number and sizes of shared libraries or classes it loads, whereas static libraries, executable programs and static data areas contribute to a fixed (constant) portion. Programs themselves often do not contribute the largest portions to their own memory footprints. In a Java program, the memory footprint is predominantly made up of the runtime environment in the form of Java Virtual Machine (JVM) itself that is loaded indirectly when a Java application launches.

Upvotes: 1

Related Questions