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 6816175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:53:39+00:00 2026-05-26T20:53:39+00:00

A small program which loads image and logs its size. It is compiled with

  • 0

A small program which loads image and logs its size. It is compiled with ARC support, llvm 3.0. I run it on iPod 4.2 and get some funny numbers… The program is compiled in “Release” mode with “-Os” (default optimization for “Release” in xcode). This whole thing does NOT happen in Simulator. It looks to me that @autoreleasepool in combination with a loop corrupts stack… Note, that I had to isolate the problem for this post with this simple example.

--------->

int main(int argc, char *argv[])
{        
    @autoreleasepool
    {
        return UIApplicationMain(argc, argv, nil,
                                 @"AppDelegate");
    }    
}

@interface AppDelegate : UIWindow <UIApplicationDelegate>
@end

@implementation AppDelegate

-(void)loadImageAndLogValues
{
        // image from bundle 256x26
    UIImage *image = [UIImage imageNamed:@"Image.png"];

    for (int i = 0; i < 1; i++)
    {
      NSLog(@"size=%@", NSStringFromCGSize(image.size));
      NSLog(@"w=%f", image.size.width);
      NSLog(@"h=%f", image.size.height);
      NSLog(@"------------------------");
    }
}

-(BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    self.frame = [UIScreen mainScreen].bounds;
    self.backgroundColor = [UIColor blueColor];
    [self makeKeyAndVisible];

    [self loadImageAndLogValues];

    UIGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
        initWithTarget:self 
                action:@selector(loadImageAndLogValues)];
    [self addGestureRecognizer:tap];

    return YES;
}

@end

<------------------

And this is the output after I tap the screen once (“h” is WRONG when logged after tapping! The height of the image is 26…):

2011-10-21 01:54:48.677 Tmp[2522:307] size={256, 26}
2011-10-21 01:54:48.696 Tmp[2522:307] w=256.000000
2011-10-21 01:54:48.705 Tmp[2522:307] h=26.000000
2011-10-21 01:54:48.715 Tmp[2522:307] ------------------------
2011-10-21 01:54:50.576 Tmp[2522:307] size={256, 26}
2011-10-21 01:54:50.582 Tmp[2522:307] w=256.000000
2011-10-21 01:54:50.589 Tmp[2522:307] h=256.000000
2011-10-21 01:54:50.595 Tmp[2522:307] ------------------------

Now, I remove @autoreleasepool from main():

int main(int argc, char *argv[])
{        
        //@autoreleasepool
        //{
        return UIApplicationMain(argc, argv, nil,
                                 @"AppDelegate");
        //}    
}

Run the program and tap. Still wrong value for “h”, but when calling “loadImageAndLogValues” directly from “application:didFinishLaunchingWithOptions:”…

2011-10-21 02:02:08.222 Tmp[2544:307] size={256, 26}
2011-10-21 02:02:08.240 Tmp[2544:307] w=256.000000
2011-10-21 02:02:08.250 Tmp[2544:307] h=256.000000
2011-10-21 02:02:08.259 Tmp[2544:307] ------------------------
2011-10-21 02:04:59.097 Tmp[2544:307] size={256, 26}
2011-10-21 02:04:59.103 Tmp[2544:307] w=256.000000
2011-10-21 02:04:59.109 Tmp[2544:307] h=26.000000
2011-10-21 02:04:59.115 Tmp[2544:307] ------------------------

So?… ARC + llvm 3.0 + -Os + @autoreleasepool + for(;;) + image.size.width/height is not working for me 🙂 Please help! Thank you!

  • 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-26T20:53:39+00:00Added an answer on May 26, 2026 at 8:53 pm

    After (incidentally) reading LLVM vs. GCC for iOS development managed to fix the problem… ARMv6 is exactly for my iPod which was giving troubles. The “fix” is to disable thumb support for ARMv6 configuration only. Great, but weird…

    enter image description here

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

Sidebar

Related Questions

I currently have a small Java program which I would like to run both
I have created a small program which logs text data to a file on
I'm writing a small program which will make a GET request to a server
I've made a small program which has 2 buttons and each does certain thing.
Okay, I got this small program which tags (as in ID3v2.4 etc.) some music
I would like to write a small program in C# which goes through my
I have a small Python program, which uses a Google Maps API secret key.
If i create a program, which in one small out of the way area,
I want to make a small program which use local namespace socket and I
I am trying to write a small program which has to store and retrieve

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.