02-05-2013 08:32 AM
I have written a code which captures image using camera and the captured image is stored in a file on SD Card. The code works fine when tested with OS 5, 6 and 7. While testin on blackberry device 9350, after capturing 15 images, the application just hangs and is not responding. The only way is to take out the battery and restart the device. When tested it on 9350 simulator it gives a Device Error (DE373) with a message saying "Timer wait failed". The simulator goes in a freeze state thereafter and no error or exception is shown on console as well.
No timer is being used in the implementation.Is this related to device specific issue or anything else ??
Your help will be greatly appreciated,
Thanks in Advance
02-07-2013 05:09 PM
You say it works with BB 5, 6, and 7, but not on a 9350... what version on a 9350 is it not working on?
That also almost sounds like a hardware issue, except the simulator does it too. I looked it up, DE 373 is a system error that means "Hardware Timers are corrupted." That isn't terribly useful information I grant you, but what it means for you is that there is either a bug in our BlackBerry OS you've just discovered, or the BlackBerry OS installation on your 9350 has become corrupted somehow. Since the simulator is experiencing it as well as your phone, my guess is the former.
You can try to update your OS and see if that helps - even using a newer simulator if one is available would help you test if the problem has been resolved. Alternatively, you can file an issue here. If you log an issue please include the build number you are using (available from settings) and some sample code that reproduces it if you can!
Sorry I don't have better advice to offer!
02-20-2013 02:15 AM - edited 02-20-2013 02:36 AM
The same error "Device Error-Timer Wait failed" is thrown when I capture images from Blackberry 9930 after capturing 30-35 images continuously. Sometimes i also get Device Error DE308- An internal occur has occurred. On searching for this, I came to know that this is a known issue on BB 9350 simulator. It says the log files are not saved. How can i get rid of these issues ??
02-20-2013 04:31 AM
The fact that you see this on a number of devices suggests to me that the problem is actually in the way you are handling the processing. This might be OK, but it might be that on some phones this does not work correctly. For example, if you are actually storing the image onto the SD Card using the Event Thread, this will block the Event Thread. On some phones say with slow SD Card this will cause a problem, alternatively on phones with a large camera resolution this can also cause a problem but it might work fine on a number of phones. I'm not suggesting this is your problem, I am just giving you an example of where a certain design will work fine on some phones and fail on others.
In order to look for a design issue like this, we need to understand exactly how you process the camera images, especially how you process multiple images. Can you please describe this process.
The other thing that we need to be aware of is the size of these images. If you are not releasing the storage as your go, or you have a queue of large images to be stored, this will tie up a lot of memory - images are large and are stored in single memory blocks thus potentially placing a large strain on the phone RAM. Use the profiler to work through your code to make sure tat there are no memory leaks from your processing. By memory leaks I mean there are Objects or storage you have retained a reference to, so that the Garbage Collector can't free them, but that you will never use again.
02-20-2013 06:29 AM
My approach is as follows :-
Garbage Collection feature has been taken care of. My testing approach is that everytime I capture a image, the preview is shown to me, i select "Don't Save" option so that the image is dropped and to check if there is any issue with the file system or such. After capturing 15-20 images, the device error DE373- Timer wait failed is thrown and the simulator freezes. The same case happens if i choose the option to save images.
Please let me know your comments if any.
02-20-2013 07:23 AM - edited 02-20-2013 07:24 AM
I would use the profiler and make sure that there are no redundant objects created. Search the forum for details on using the profiler. But the general idea is that you take a snapshot, then let your processing go through the process you are concerned about, then take another snapshot and compare the memory usage between the two, looking for new Objects that were not there before. So in this case, I would snapshot after I have selected 'Don't Save' and everything should be freed. Then go through a complete cycle and take another snapshot at the next "Don't Save". In theory there should not be any additional Objects
There is always to possibility that you will get Objects that have not yet been garbage collected, so you can invoke the garbage collection (System.gc() from memory), just before the point you put the break point in and take the snapshot.
My quick review suggests that the 'hand crafted' rescaling approach you are using is pretty compute and memory intensive. As the poster suggests, you should really use scaleInto if you can. So if you are targeting OS 5.0 and above, use scaleInto. Actually if you wanted one thing that I would be suspicious of, this is it. I suspect you are doing this scaling on the Event Thread and that will block it - for a considerable time potentially. scaleInto will be much faster, and as the scaling looks pretty crude, I suspect scaleInto will give you a better result.