data1 = null;
in an attempt to get the garbage collector to clear it out of memory. I'm still receiving the heap space Memory error. I've increased the memory allocation in my .ini file as well. I'm at my wits end here because if I can't pull this off, all my work has been for nill. Below is the snippet of code as I've tried to implement to use garbage collection to resolve. I know this isn't an SSCCE, but can anyone weigh in on why the garbage collector isn't clearing the unneeded objects from memory? Possible solutions? I'd really appreciate any help I can get!
//Get the JTable and return it
JTable getTable() throws IOException {
File f = new File("C:\\PCQ\\A_R.csv");
Scanner s = new Scanner(f);
String[] colNames = {
/*
"PRINT", "ECN", "CUSTOMER", "MODEL", "SERIAL", "NOMENCLATURE", "MFR_CD",
"SUB_CUSTODIAN", "SCHED_LAB", "ON_SITE_SERVICE", "CAL_STD",
"SERVICE_LABEL_CD", "PHASE_ID", "METRL_CYCLE", "WORKLOAD_NORM_HRS",
"CLASS_STD"
*/
"PRINT",
"SERVICED_LAB",
"CUSTOMER_ID",
"MODEL_NO",
"SERIAL_NO",
"ECN",
"NOMENCLATURE",
"SUB_CUSTODIAN",
"METRL_CYCLE",
"MFR_CD",
"UIC",
"SCHED_LAB",
"PROCEDURE_USED",
"VALUE_FIXED",
"NSN",
"PART_OF",
"ON_SITE_SERVICE",
"CAL_STD",
"SERVICE_LABEL_CD",
"PLANT_ACCT",
"SCAT_CD",
"PHASE_ID",
"APPROVED_PROCEDURE",
"INV_SHOP_NO",
"CLASS_STD",
"TYPE_STD",
"WIP_STATUS",
"EQPMT_TYPE_CD",
"ICN",
"PRINT_METERCARD_FLG",
"EQPMT_STATUS_CD",
"DELAY_REASON_CD",
"EQPMT_STATUS_CD",
"SPCL_INSTR_CD",
"WORKLOAD_NORM_HRS",
"METRL_CYCLE",
"DTC_SYS",
"DTC_RCVD",
"DTC_INDUCT",
"DTC_DELAY",
"DTC_REPTD",
"DTC_LSTCAL",
"DTC_NXT_DUE",
"DTC_RECALL",
"DT_CMPL",
"DT_CREATE",
"COST",
"CAT_CUS",
"CAT_LAB",
"LAB_TYPE",
"ACC_CODE",
"FLAG_OFFLN",
"DTC_REIND"
};
int cols = colNames.length;
//Import CSV File into 2d array
List<Object[]> list = new ArrayList<Object[]>();
int c = 0;
while (/*s.hasNextLine() */c < 100000 ) {
Object[] line = s.nextLine().split(",");
/*
for(int z = 0; z < 50; z++){
list.add(new Object[] {
(Boolean.FALSE),
(line[z])
});
c++;
}
*/
list.add(new Object[] {
(Boolean.FALSE), //PRINT
(line[0]), //'LAB_SVC',
(line[1]), //'CUSTOMER',
(line[2]), //'MODEL',
(line[3]), //'SERIAL',
(line[4]), //'ECN',
(line[5]), //'NOMEN',
(line[6]), //'SUB_CUST',
(line[7]), //'METRL_C',
(line[8]), //'FSCM',
(line[9]), //'UIC',
(line[10]), //'LAB_SCHED',
(line[11]), //'PROC_USED',
(line[12]), //'VALUE_FIXD',
(line[13]), //'NSN',
(line[14]), //'PART_OF',
(line[15]), //'ON_SITE',
(line[16]), //'STD_CAL',
(line[17]), //'LABEL_SVC',
(line[18]), //'PLANT_ACCT',
(line[19]), //'SUB_CAT',
(line[20]), //'PHASE',
(line[21]), //'PROC_APPR',
(line[22]), //'SHOP_INV',
(line[23]), //'STD_CLASS',
(line[24]), //'STD_TYPE',
(line[25]), //'STATUS',
(line[26]), //'TYPE_EQUIP',
(line[27]), //'ICN',
(line[28]), //'FLAG_MC',
(line[29]), //'EQUIP_STAT',
(line[30]), //'DELAY_CD',
(line[31]), //'COND_EQUIP',
(line[32]), //'INST_SPCL',
(line[33]), //'HRS_STD',
(line[34]), //'METRL_N',
(line[35]), //'DT_SYS',
(line[36]), //'DT_RCVD',
(line[37]), //'DT_INDUCT',
(line[38]), //'DT_DELAY',
(line[39]), //'DT_REPTD',
(line[40]), //'DT_LSTCAL',
(line[41]), //'DT_NXTDUE',
(line[42]), //'DT_RECALL',
(line[43]), //'DT_CMPL',
(line[44]), //'DT_CREATE',
(line[45]), //'COST',
(line[46]), //'CAT_CUS',
(line[47]), //'CAT_LAB',
(line[48]), //'LAB_TYPE',
(line[49]), //'ACC_CODE',
(line[50])//, //'FLAG_OFFLN',
//(line[51]) //'DTC_REIND',
}
);
c++;
}
int rows = list.size();
int numberOfColumns = 15;
Object[][] data = new Object[rows][cols];
for (int i = 0; i < rows; i++) {
data[i] = list.get(i);
}
//Create model for JTable
model = new DefaultTableModel(data, colNames) {
public boolean isCellEditable(int rowIndex, int mColIndex) {
if(mColIndex > 0){
return false;
}
else return true;
}
public Class getColumnClass(int col) {
Object o = getValueAt(0, col);
if(o == null){
return Object.class;
}
else {
return o.getClass();
}
}
};
data = null;
list = null;
List<Object[]> list2 = new ArrayList<Object[]>();
int c2 = 99999;
while (/*s.hasNextLine() */c2 > 99998 && c2 < 200000 ) {
Object[] line2 = s.nextLine().split(",");
list2.add(new Object[] {
(Boolean.FALSE), //PRINT
(line2[0]), //'LAB_SVC',
(line2[1]), //'CUSTOMER',
(line2[2]), //'MODEL',
(line2[3]), //'SERIAL',
(line2[4]), //'ECN',
(line2[5]), //'NOMEN',
(line2[6]), //'SUB_CUST',
(line2[7]), //'METRL_C',
(line2[8]), //'FSCM',
(line2[9]), //'UIC',
(line2[10]), //'LAB_SCHED',
(line2[11]), //'PROC_USED',
(line2[12]), //'VALUE_FIXD',
(line2[13]), //'NSN',
(line2[14]), //'PART_OF',
(line2[15]), //'ON_SITE',
(line2[16]), //'STD_CAL',
(line2[17]), //'LABEL_SVC',
(line2[18]), //'PLANT_ACCT',
(line2[19]), //'SUB_CAT',
(line2[20]), //'PHASE',
(line2[21]), //'PROC_APPR',
(line2[22]), //'SHOP_INV',
(line2[23]), //'STD_CLASS',
(line2[24]), //'STD_TYPE',
(line2[25]), //'STATUS',
(line2[26]), //'TYPE_EQUIP',
(line2[27]), //'ICN',
(line2[28]), //'FLAG_MC',
(line2[29]), //'EQUIP_STAT',
(line2[30]), //'DELAY_CD',
(line2[31]), //'COND_EQUIP',
(line2[32]), //'INST_SPCL',
(line2[33]), //'HRS_STD',
(line2[34]), //'METRL_N',
(line2[35]), //'DT_SYS',
(line2[36]), //'DT_RCVD',
(line2[37]), //'DT_INDUCT',
(line2[38]), //'DT_DELAY',
(line2[39]), //'DT_REPTD',
(line2[40]), //'DT_LSTCAL',
(line2[41]), //'DT_NXTDUE',
(line2[42]), //'DT_RECALL',
(line2[43]), //'DT_CMPL',
(line2[44]), //'DT_CREATE',
(line2[45]), //'COST',
(line2[46]), //'CAT_CUS',
(line2[47]), //'CAT_LAB',
(line2[48]), //'LAB_TYPE',
(line2[49]), //'ACC_CODE',
(line2[50])//, //'FLAG_OFFLN',
//(line2[51]) //'DTC_REIND',
}
);
c2++;
}
int rows2 = list2.size();
Object[][] data2 = new Object[rows2][cols];
for (int i = 0; i < rows2; i++) {
data2[i] = list2.get(i);
}
for(int z = 0; z < rows2; z++){
model.insertRow(z, data2[z]);
}
data2 = null;
list2 = null;

New Topic/Question
Reply



MultiQuote




|