I have a problem capturing videos with my devices. I have a N96 (S60 3rd Edition, Feature Pack 2) and 6555 (Series 40 5th Edition) devices which I have used for testing the capturing. The actual problem is setting the RecordControl to limit the size of the captured video in a manner that it would not exceed available memory. I have tried to set the memory by calling Runtime method freeMemory but it resulted that N96 captured clips were 2-5 seconds long. However 6555 worked fine with using the freeMemory method and it captured about two minutes long videos.

I have also tried to set the RecordControl size limit to Integer.MAX_VALUE as suggested in API documentation to remove the limitations. Again 6555 worked fine and stopped the recording automatically when it ran out of memory. I ran few tests with N96 and was able to capture videos of ~3 minutes and ~5 minutes. After these tests I ran a 15 minutes long recording and I got a IOException from RecordControl commit method. The actual message was: "commit() failed: -4" so apparently N96 did not stop the recording when it ran out of memory.

So could anybody help me with setting the RecordControl size limitation in a manner that it would use all memory available? I would prefer not to use any constant value for size limitation since it could cause problems with some devices and my application is supposed to work on as many devices as possible.

Thanks in advance.