如何减少Java中的RAM使用量?

ReportDatabase类

public class ReportDatabase {

    private static final Map<String, Report> reportTypes;
    private static final String[] reportTypeNameVersion = {
            "Payroll Tax Report 1",
            "Capital Gains Tax Report 1",
            "Overall Expenditure Report 1",
            "Dark Costs Report 1",
            "Petty Cash Report 1",
            "Enron Fund Report 1",
            "COVID-19 Report 1",
            "COVID-20 Report 1",
            "Brawndo Investment Report 1",
            "Philanthropy Report 1",
            "Payroll Tax Report 2",
            "Capital Gains Tax Report 2",
            "Overall Expenditure Report 2",
            "Dark Costs Report 2",
            "Petty Cash Report 2",
            "Enron Fund Report 2",
            "COVID-19 Report 2",
            "COVID-20 Report 2",
            "Brawndo Investment Report 2",
            "Philanthropy Report 2"
    };

    static {
        reportTypes = new HashMap<>();

        for (String name: reportTypeNameVersion) {
            reportTypes.put(name, new ReportImpl(name.substring(0, name.length()-1), getReportCommission(), getReportData(), getReportData(), getReportData(), getReportData(), getReportData()));
        }
    }

    /**
     * Note from Tim:
     * The version number is entirely arbitrary and not used anywhere else, so we can't use it as a composite key...
     * There are also more than 2 versions per name in the full system.
     *
     * The recreation/copying here is simulating a networked database connection
     */
    public static Collection<Report> getTestReports() {

        Collection<Report> originals = reportTypes.values();
        List<Report> result = new ArrayList<>();

        for (Report original: originals) {
            result.add(new ReportImpl(original.getReportName(),
                    original.getCommission(),
                    original.getLegalData().clone(),
                    original.getCashFlowData().clone(),
                    original.getMergesData().clone(),
                    original.getTallyingData().clone(),
                    original.getDeductionsData().clone()));
        }

        return result;
    }

    private static double[] getReportData() {

        /*
        Note from Tim:
        If your machine's memory can't handle the whole product data, you could set this lower while you work out
        a way to stop the RAM explosion? We do need to be able to get at the whole product though.
        The database doesn't though...
         */

        double[] result = new double[500000];
        Random random = new Random();

        for (int i = 0; i < result.length; i++) {
            result[i] = random.nextDouble();
        }

        return result;
    }

    private static double getReportCommission() {
        Random random = new Random();

        return 1.0 + 99.0 * random.nextDouble();
    }
}

ReportImpl类:

import au.edu.sydney.cpa.erp.ordering.Report;

public class ReportImpl implements Report {

    private String name;
    private double commissionPerEmployee;
    private double[] legalData;
    private double[] cashFlowData;
    private double[] mergesData;
    private double[] tallyingData;
    private double[] deductionsData;

    public ReportImpl(String name,
                      double commissionPerEmployee,
                      double[] legalData,
                      double[] cashFlowData,
                      double[] mergesData,
                      double[] tallyingData,
                      double[] deductionsData) {
        this.name = name;
        this.commissionPerEmployee = commissionPerEmployee;
        this.legalData = legalData;
        this.cashFlowData = cashFlowData;
        this.mergesData = mergesData;
        this.tallyingData = tallyingData;
        this.deductionsData = deductionsData;
    }

    @Override
    public String getReportName() {
        return name;
    }

    @Override
    public double getCommission() {
        return commissionPerEmployee;
    }

    @Override
    public double[] getLegalData() {
        return legalData;
    }

    @Override
    public double[] getCashFlowData() {
        return cashFlowData;
    }

    @Override
    public double[] getMergesData() {
        return mergesData;
    }

    @Override
    public double[] getTallyingData() {
        return tallyingData;
    }

    @Override
    public double[] getDeductionsData() {
        return deductionsData;
    }

    @Override
    public String toString() {

        return String.format("%s", name);
    }
}

类中的方法,从ReportDatabase类中调用方法getTestReports()

public List<Report> getAllReports() {
        if (null == token) {
            throw new SecurityException();
        }

        return new ArrayList<>(ReportDatabase.getTestReports());
    }

对于上述类,我需要减少RAM的使用,规则是,我需要使用ReportDatabase.getTestReports(),并且我不能修改ReportDatabase类中的任何内容(仅)。如果我打印出RAM消耗,则约为450MB。我尝试创建一个ReportFactory类以应用flyweight模式,但我认为实例化ReportDatabase类以直接使用getTestReports会占用约400MB RAM,因为:

有20个报告,每个报告有6个双数组。每个数组有500000个双数。如果我们计算内存,则Java中的双精度数字是8个字节。总内存将是

8⋅500000⋅6⋅20/(1024⋅1024)≈450MB

如何减少以上类的RAM使用量?我可以得到任何提示吗?