Performance engineering

Logical retained payload

Distinguish logical bytes from measured heap. Executed Java 21 functional example, not a performance claim.

Formal Syntax & Structure

java syntaxjava
sum(payloadLengths)

Working Example

Example Snippetjava
public class Main {
    public static void main(String[] args) {        long allocated=0; byte[][] retained=new byte[2][];        for(int i=0;i<8;i++){byte[] b=new byte[1024];allocated+=b.length;retained[i%2]=b;}        System.out.println(allocated);        System.out.println(retained[0].length+retained[1].length);    }}
Java Reference