HI,
There is a strange out of memory error issue.
I create a class to parse live streaming, and the class needs buffers to keep these raw data.
Here are code snippets:
/* Initial and uninitial buffer in class */
private final int MAX_BUFFER = 16;
protected byte[][] m_byStreamBuf = null; // Frame buffer
public void InitBuffer() {
m_byStreamBuf = new byte[MAX_BUFFER][];
m_byStreamBuf[0] = new byte[512*1024]; // for I Frame
for (int i = 1; i < MAX_BUFFER; i++) {
m_byStreamBuf[i] = new byte[256*1024]; // for P frame
}
}
public void UninitBuffer {
this.m_byStreamBuf = null;
System.gc();
}
Out of memory error will occur after start and close the application several times(maybe three or four times actually).
I check that the error occurs on the line which allocates memory.
I have try to call System.gc() when close application every time.
But it seems that the application still allocate too much memory and do not release all of them.
Thanks for any suggestion.
Regards,
Caxton