Posted By:
derwood_king
Posted On:
Thursday, July 20, 2006 12:11 PM
Hello, I am serializing some data and I don't know why the program is hanging. It writes out the file, but doesn't want to close the file and finish. I had to allocate a lot of memory at runtime or it wouldn't begin to work. When I run the same program to serialize a smaller dataset it doesn't hang. The code is as follows: //allocate an array report, to hold the exact number of reports received. wrf_report_3d_regular[] report = new wrf_report_3d_regular[i]; for(ii=0;ii <=i-1;ii++){ report[ii] = new wrf_report_3d_regular(t[ii],p[ii],pb[ii],qvapor[ii], qcloud[ii],qrain[ii],qice[ii],qsnow[ii],qgraup[ii]); //System.out.println(report[ii].print()); }
More>>
Hello,
I am serializing some data and I don't know why the program is hanging. It writes out the file, but doesn't want to close the file and finish. I had to allocate a lot of memory at runtime or it wouldn't begin to work. When I run the same program to serialize a smaller dataset it doesn't hang. The code is as follows:
//allocate an array report, to hold the exact number of reports received.
wrf_report_3d_regular[] report = new wrf_report_3d_regular[i];
for(ii=0;ii
<=i-1;ii++){
report[ii] = new wrf_report_3d_regular(t[ii],p[ii],pb[ii],qvapor[ii],
qcloud[ii],qrain[ii],qice[ii],qsnow[ii],qgraup[ii]);
//System.out.println(report[ii].print());
}
//serialize
try{
try{
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("serialized_WRF_3d_regular.dat"));
out.writeObject(report);
//out.flush();
out.close();
}catch(FileNotFoundException ex){ex.printStackTrace();}
}catch(IOException ioe){ioe.printStackTrace();}
To run the program I use:
java -Xmx1024M -classpath . JAVASPACECODE.readDemoWRF_3d_regular
512M was not enough.
Any ideas are welcome.
TIA,
Derwood
<<Less