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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:18:35+00:00 2026-05-15T05:18:35+00:00

i have a problem. When i compile my program there isn’t a error but,

  • 0

i have a problem.
When i compile my program there isn’t a error but, when i start it these retern with “EXC_BAD_ACCESS”.
I looking for the error with the debug and i find it in these method but i don’t understand where…

PS:the program enters in the loop sometimes.

-(void)updateMinPosition{

    float valueMinX = 150;
    float valueMinY = 150;
    float valueMinZ = 150;

    NSString *nameMinimoX = [NSString   stringWithFormat:@"default"];
    NSString *nameMinimoY = [NSString   stringWithFormat:@"default"];
    NSString *nameMinimoZ = [NSString   stringWithFormat:@"default"];

    for(int i = 0; i< [arrayPosizioniMovimento count]; i++){

        //Posizione is my class. It contain a NSString name, 3 float valueX, valueY, valueZ
        Posizione *tempPosition;
        tempPosition = [[Posizione alloc]init];

        tempPosition = [arrayPosizioniMovimento objectAtIndex:i];

        if(tempPosition.valueX <= valueMinX){
            valueMinX = tempPosition.valueX;
            nameMinimoX = tempPosition.nome;
        }

        if(tempPosition.valueY <= valueMinY){
            valueMinY = tempPosition.valueY;
            nameMinimoY = tempPosition.nome;
        }

        if(tempPosition.valueZ <= valueMinZ){
            valueMinZ = tempPosition.valueZ;
            nameMinimoZ = tempPosition.nome;
        }

        [tempPosition dealloc];
    }

    labelMinX.text = nameMinimoX;
    labelMinY.text = nameMinimoY;
    labelMinZ.text = nameMinimoZ;   
}
  • 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-15T05:18:36+00:00Added an answer on May 15, 2026 at 5:18 am

    For the 1st glance there’re several problems with your code:

        Posizione *tempPosition;
        tempPosition = [[Posizione alloc]init];
    
        tempPosition = [arrayPosizioniMovimento objectAtIndex:i];
    

    Here in the second line you create new Posizione instance and right after that assign another value to the same variable. In effect that will mean that your created instance will be never used and cause memory leak. To use element from array just write

    Posizione *tempPosition = [arrayPosizioniMovimento objectAtIndex:i];
    

    The second one – is the following line

    [tempPosition dealloc];
    

    First of all you should never call this method directly but rather send an object -release message – it will be deallocated automatically when its retain count becomes 0. In your case you do not retain tempPosition object in that code so there;s no need to release it here – just remove that line.

    P.S. Using fast enumeration can also make your code more readable and less error prone:

    for (Posizione *tempPosition in arrayPosizioniMovimento){
       if(tempPosition.valueX <= valueMinX){
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

G'day there! I have a problem compilation of mupdf for android Compile thumb :
I'm trying to compile a program which uses cabarc.exe , but I don't have
I have a problem while trying to compile and link my program with dmalloc.
i have problem with maven. When i try to compile test classes ( mvn
I have a problem - i can't compile SqlCipher. I'm using this http://groups.google.com/group/sqlcipher/browse_thread/thread/55c6296b56bf4533/c792bbec6df7d4f4?tvc=2#c792bbec6df7d4f4 instructions
i am a beginner and i have a problem : this code doesnt compile
I have a cross platform app, I want to compile on Linux. The problem
I have the same error than here . There's no solution there and also
I have recently discovered an annoying problem in some large program i am developing;
I have the following problem, will try to describe it shortly. In my program

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.