D
Digital Puer
Hi, I am running into an OutOfMemoryError and need some help.
My code looks essentially like this:
ByteArrayData ref; // has a field: byte[] _data
while(i = 0 to 100000 files)
{
// reads bytes from file (with FileInputStream) into ref._data
ref = new ByteArrayData(filename);
send_data_over_network(ref);....
// in lieu of free() :
ref._data = null;
ref = null;
// System.gc();
}
I am basically creating new objects inside a tight loop. I am evidently
running out of memory because the memory referenced by 'data' is not
being free'd (to use the C term). Can someone help?
My code looks essentially like this:
ByteArrayData ref; // has a field: byte[] _data
while(i = 0 to 100000 files)
{
// reads bytes from file (with FileInputStream) into ref._data
ref = new ByteArrayData(filename);
send_data_over_network(ref);....
// in lieu of free() :
ref._data = null;
ref = null;
// System.gc();
}
I am basically creating new objects inside a tight loop. I am evidently
running out of memory because the memory referenced by 'data' is not
being free'd (to use the C term). Can someone help?