Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6237323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:00:26+00:00 2026-05-24T11:00:26+00:00

I am currently working with Monotouch. I have an application which opens the camera

  • 0

I am currently working with Monotouch. I have an application which opens the camera and then needs to process the image that is currently being captured. I am using code which is very similar to https://github.com/reinforce-lab/com.ReinforceLab.MonoTouch.Controls/tree/master/VideoCaptureSample/

The difference of interest between my code and theirs is that in OverlayView.cs which is placed over my UIImagePickerController however, I have the following code:

using (var screenImage = CGImage.ScreenImage.WithImageInRect(Frame))
{
    _imageView = UIImage.FromImage(screenImage);
    Bitmap srcbitmap = new System.Drawing.Bitmap(_imageView);
}

However running this code will cause memory to continuously fill up until the application closes. It seems as though the System.Drawing.Bitmap is never disposed of. I am using ZXing.monotouch so I need the bitmap so that I can create a bytes[] of the bitmap to pass into an RGBLuminanceSource

Any ideas on how I can get this to play nicely?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:00:27+00:00Added an answer on May 24, 2026 at 11:00 am

    If you’re using the code from [1] then it looks rather incomplete. Nothing frees the memory allocated from AllocHGlobal, which would lead to out-of-memory condition.

    This is not a MonoTouch bug – the zxing code should implement IDisposable on the Bitmap class and ensure everything gets freed when disposed (or when the GC runs its finalizer).

    You can either complete the class (i.e. implement IDisposable) or copy/paste the part that provides you a byte[] buffer containing the image (and free the unmanaged memory once it’s copied into the managed buffer).

    [1] https://github.com/JohnACarruthers/zxing.MonoTouch/blob/master/Bitmap.cs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a consumer mobile application project and have read that 40%
Am currently working on an application that requires users to submit posts and comments
I'm currently working on creating a new C# project that needs to interact with
I have an application that uses Monotouch/C# on the Mac as the front end,
I have not been working with Monotouch (or the iphone for that matter) for
I have an monotouch application that includes an objective-c static library. The application runs
Currently working on a bespoke ecommerce application using Codeigniter. I have a products table
Where currently working on an C# application that requires data to be stored in
Im currently working with an API which requires we send our collection details in
I`m currently working on a script, and I have the following situation. function somnicefunction()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.