Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 7703 [details]
When attempting to get data from hardware Camera preview frame using Camera.IPreviewCallback handler and eihter SetPreviewCallback or SetPreviewCallbackWithBuffer, the image data byte buffer seem to be initiated in memory on each callback generating a lot of strain on the GC, resulting in regular GC collections and subsequently freezes in the application.
Both using SetPreviewCallback and using our own buffer with SetPreviewCallbackWithBuffer cause this GC issue. In fact, this problem has been discussed here: http://forums.xamarin.com/discussion/6114/camera-addcallbackbuffer-causes-rapid-gcs-in-dalvik-is-there-a-way-around-this
Proposed solutions include either doing it yourself in Java (which you'll admit voids the entire purpose of Xamarin Android), or using a clever but unsafe and complicated trick that is not guaranteed to work in future revisions of Xamarin. Both solutions seem subpar and in my opinion you should provide a way to read that preview buffer with minimal GC overhead (avoiding any copy would be best though I understand that's complicated; though iOS implementation of similar feature allow direct access to IntPtr byte array which yields excellent results).
I've include a repro project to illustrate this issue.
I have checked this issue with given sample project. Could you Please checked the screencast and let me know If you also have getting same behavior, Or I have missed anything.
Xamarin Studio->Version 5.5.3 (build 6)
Xamarin.Android->Version: 4.18.1 (Business Edition)
Mac OS X 10.9.4
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!