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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:23:25+00:00 2026-05-31T22:23:25+00:00

I have an object that contains a array. On initialization of this object, the

  • 0

I have an object that contains a array. On initialization of this object, the array is allocated and properly filled (as I can see in the debugger). This object is use to manage elements in a single view.

My problem is that when I try to call the object a second time, the array (and all other parameter of this object) are nil yet they have a memory address (again as seen in debugger).

This is the .h of the object in question :

#import <Foundation/Foundation.h>

#import "ObjectDef.h"
#import "AbstractNode.h"

@interface RenderingMachine : NSObject
{    
    NSMutableArray* _objectID;    // pair list
    NSMutableArray* _objectList;  // node list
    ObjectDef* _defs;             // definition of pairs

    unsigned int _size;
    unsigned int _edgeSize;

    AbstractNode* _lastNode;
}

-(void) InitializeMachine;
-(bool) AddObjectByIndex:(int)index :(float)x :(float)y :(float)originX :(float)originY;
-(bool) AddObjectByType:(NSString*)type;
-(NSMutableArray*) GetObjectID;
-(NSMutableArray*) GetObjectList;
-(unsigned int) Size;
-(void) DrawAllNode;
-(int) ComputePar;
-(void) ComputeLastEdge:(int)edgeCount;

//+(RenderingMachine*) GetMachine;

@end

My main problem right now is with _defs which is filled in InitDefinitions :

-(void) InitializeMachine
{
    _defs = [[ObjectDef alloc] init];
    [_defs InitDefinitions];
    _objectID = [[NSMutableArray alloc] init];
    _objectList = [[NSMutableArray alloc] init];
    _objectID = [NSMutableArray arrayWithObject:[_defs GetPair:3]]; // adding the field node ID

    AbstractNode* rootNode = [[FieldNode alloc] init];
    _objectList = [NSMutableArray arrayWithObject:rootNode]; // adding the field node as root node

    _size = 1;
    _edgeSize = 0;
}

What I’d like to know is if might be a bad alloc / init call or could it be a problem with the ARC of xcode because this particular file compiles with ARC (the other being ignore with “-fno-objc-arc”).

Also, as mentionned the _defs is problematic, but all the property declared under @interface are having the same problem.

  • 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-31T22:23:27+00:00Added an answer on May 31, 2026 at 10:23 pm

    First you create a retained object with _objectID = [[NSMutableArray alloc] init];
    and then you overwrite it with an autoreleased one _objectID = [NSMutableArray arrayWithObject:[_defs GetPair:3]];

    to add the object better use [_objectID addObject:[_defs GetPair:3]];

    same thing with the _objectList Object

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

Sidebar

Related Questions

I have an array that contains standard class object. How can I return the
I have an object that contains two arrays, the first is a slope array:
I have a class that contains an array. I want this array to be
I have a custom object that contains an array (called children) where objects of
I have WCF service that returns an object that contains an array of bytes
I have a Model class for a Generic Object that contains an array of
I have an object that contains an array of objects. obj = {}; obj.arr
I have an object Results that contains an array of result objects along with
If I have an object MyObject that contains an array of objects ListOfOtherObjects and
I have a vector-like class that contains an array of objects of type T

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.