[jmm-dev] Require some insight regarding Objects

Prakhar Makhija matcdac at gmail.com
Mon Nov 13 15:27:14 UTC 2017


and Nicobar Islands","someAddress":"House Number 143, Near Pie Beach, Port
Blair, Andaman and Nicobar Islands, India -
744101","interestedActivityCode":72681.0,"emailId":"munchymuffin at gmail.com"}

*class definition*

public class MyClass {
private String identificationNumber;

private String name;
private String someAddress;
private String addressState;
private String bornLocation;

private String someSocialStatus;
private String prefferedClass;
private String prefferedCategory;
private String subCategory;

private String dateOfBeingBorn;

private String interestedActivity;
private Double interestedActivityCode;

private Double personalEarnings;
private Double matchfulDesiredEarnings;

private String emailId;
// getters & setters
// constructors

*code block*

import com.fasterxml.jackson.databind.ObjectMapper;

ObjectMapper objectMapper = new ObjectMapper();
MyClass myClassObj = objectMapper.readValue(currentLine.getBytes(),


Likewise having 1.5 million json files
Total size which they are occupying on disk is 940 Mega Bytes

My first doubt is when I load all these json, to make objects out of them,
will they occupy the same space in the memory?

My second doubt is about what is going on internally in the JVM's memory,
when I am making 1.5 million objects of MyClass.
Lets pick one identifier 'identificationNumber', it has 20 characters.
So just this field 'identificationNumber' is going to occupy 40 bytes only,
or (40 * 1,500,000) = 60,000,000 bytes = 57.22 MB

PS : I am not aware which mailing list should be concerned with this kind
of query, could you direct me to them, if you are not aware of what I am

More information about the jmm-dev mailing list