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

  • Home
  • SEARCH
  • 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 7397879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:48:11+00:00 2026-05-29T03:48:11+00:00

The code is pretty easy, it has to load from a settings file all

  • 0

The code is pretty easy, it has to load from a settings file all the existing images references, scale them to 250×250 and save them with another name.

The problem is that on the device (tested on an iPhone 3g and an iPad) it crashes after a while with memory warnings. On the simulator it’s working perfect.

I have a UIViewController which has on ViewDidAppear this code:

ThreadPool.QueueUserWorkItem( delegate{ 
    make_thumbs(); 
}); 

The make_thumbs function is:

void make_thumbs() 
{ 
    using( var ns = new NSAutoreleasePool() ) 
    { 
        foreach( var c in Settings.Instance.Categories ) 
        { 
            for( var i = 0; i < c.Pictures.Count; i++ ) 
            { 
                //this is the existing bundled image path 
                string     path = c.Pictures[i].PicturePath; 
                string   folder = Environment.GetFolderPath( Environment.SpecialFolder.Personal ); 
                //this is the destination image file name 
                string filename = Path.Combine( folder, c.Name + i + ".png"); 
                if( !File.Exists( filename ) ) 
                { 
                    NSError err;
                    using(UIImage img = UIImage.FromFile( path ).Scale( 250,250 ))
                    {
                        img.AsPNG().Save( filename, true, out err );
                    }
                } 
            } 
        } 
    } 
}
  • 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-29T03:48:11+00:00Added an answer on May 29, 2026 at 3:48 am

    Thx @poupou, it was almost good your answer, with a little completion: i had to put the
    using( var ns = new NSAutoreleasePool() ) inside the for loop. So my code is now like this and it’s working:

    if( !File.Exists( filename ) )
    {
        using( var ns = new NSAutoreleasePool() )
        {
            NSError err;
            using(UIImage img = UIImage.FromFile( path )) {
                using (var scaled_img = img.Scale( 250,250 )) 
                {
                    //i also add a reflection effect                             
                    using( var reflected_img = scaled_img.AddImageReflection( 0.6f ) )
                    {
                        using (var data = reflected_img.AsPNG ()) 
                        {
                            data.Save( filename, true, out err );
                        }
                    }
                 }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pretty typical bookmarklet code that's working perfectly for me in all
Title pretty much sums it up. The external style sheet has the following code:
Client code is pretty simple: <form action=DDServlet method=post> <input type=text name=customerText> <select id=customer> <option
I use Visual Studio's Code Snippet feature pretty heavily while editing c# code. I
I just came onto a project with a pretty huge code base. I'm mostly
I'm a newbie at Flash, so started playing with a pretty standard code sample:
It's pretty difficult to show code for ASP.NET here, so I will try my
I am pretty sure the following button-activated form code should raise a Control-F12 in
Im trying to get pretty.js to prettify code in CODE tags, using this js:
Python is pretty clean, and I can code neat apps quickly. But I notice

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.