I am using a NXP J3D081 80K I am compiling against 3.0.2. I am trying to simulate a simple file system. The Write routine is simply:
public class File {
public File Next;
public byte[] Name;
public byte Attributes;
public short Length;
public short Ptr;
public byte[] Data;
public byte Write(byte[] InData,short Offset, short InLength) {
if (Length == 0) {
Data = new byte[InLength];
}
else {
byte[] tmp;
tmp = new byte[(short)(Length+InLength)];
Util.arrayCopyNonAtomic(Data,(short)0, tmp, (short) 0, Length);
Data=null;
Data=tmp;
tmp=null;
}
Util.arrayCopyNonAtomic(InData,Offset,Data,Length,InLength);
Length += InLength;
return(1);
}
....
}
I am trying to append data, so I allocate a new buffer the full size of the file, copy the old data in and then copy in the new data. It was my understanding that this card has garbage collection so the old byte array should be collected at some point, but I am returning JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); and it shows that the memory available goes down by the size of the existing data array, so it is not garbage collected. Even after a power down/up of the card, the memory is not reclaimed.
What am I missing?????