You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by elsewhat <gi...@git.apache.org> on 2016/04/07 16:20:53 UTC

[GitHub] cordova-plugin-camera pull request: CB-11034: Camera.getPicture -H...

GitHub user elsewhat opened a pull request:

    https://github.com/apache/cordova-plugin-camera/pull/201

    CB-11034: Camera.getPicture -Handle of OutOfMemoryError gracefull

    Catch OutOfMemoryError for memory intensive operations and handle them
    gracefully.
    
    Tested on a Samsung SII which throws OutOfMemoryException when taking a photo and fetching it as a DATA_URL.Not able to test when selecting from gallery


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/elsewhat/cordova-plugin-camera CB-11034cordova-plugin-camera

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-camera/pull/201.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #201
    
----
commit eb3ecfff3e07b0e4dd0f6d9b723518d52962f36c
Author: Dagfinn Parnas <da...@gmail.com>
Date:   2016-04-07T14:16:55Z

    CB-11034: Camera.getPicture -Handle of OutOfMemoryError gracefull
    
    Catch OutOfMemoryError for memory intensive operations and handle them
    gracefully

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: CB-11034: Camera.getPicture -H...

Posted by riknoll <gi...@git.apache.org>.
Github user riknoll commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/201#issuecomment-207659474
  
    Ah, I think I misunderstood your JIRA and I agree with @nikhilkh that optimizing our memory use is the right approach. Looking through the code, it seems we already consume that exception in a number of places when dealing with bitmaps which is probably a very bad thing. Google provides some guidance [here](http://developer.android.com/training/displaying-bitmaps/manage-memory.html) on managing bitmap memory.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request #201: CB-11034: Camera.getPicture -Handle...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-camera/pull/201


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: CB-11034: Camera.getPicture -H...

Posted by elsewhat <gi...@git.apache.org>.
Github user elsewhat commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/201#issuecomment-207814319
  
    @riknoll @nikhilkh as an app developer I have to disagree with you.
    I would **expect a framework such as cordova to never crash an app under no circumstances if it's preventable**.
    Crashing an app is a very significant event which impacts users perception of the app very negatively and causes a significant effort wrt. end-user support for enterprise apps. It will in many cases cause entered data to be lost, and nothing frustrates users more.
    
    There is lots the app can do to handle such an exception. In my case I can make sure the users understand the issue is because the size of the image and how they can perform workarounds. 
    
    Ideally, the CameraLauncher.failPicture would allow me to pass some semantics regarding the nature of the issue for example an error code. But since this was not in place already in the code, I didn't do any changes to it. 
    
    However, **I totally agree that refactoring the code to reduce the memory footprint is an even better approach which actually tackles the root cause. But this doesn't negate the need to avoid OutOfMemoryErrors when performing memory intensive operations**. Even with an exceptionally optimized memory handling of images in cordova-camera-plugin there will always be situations where an OutOfMemoryError occurs, for example if the app uses a lot of memory on the webview side and the device is old with a strict limit on heap size (a G1 had 16MB of heap)
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: CB-11034: Camera.getPicture -H...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/201#issuecomment-207648380
  
    Silently handling OutOfMemoryError is not a good idea - we should look to optimize the code so that it uses less memory instead.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: CB-11034: Camera.getPicture -H...

Posted by riknoll <gi...@git.apache.org>.
Github user riknoll commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/201#issuecomment-207661306
  
    There are definitely cases where native exceptions should be surfaced to the javascript, but memory issues are the responsibility of the native developer. There isn't much that can be done from the Webview to correctly handle that situation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org