• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
"freed object" error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"freed object" error


  • Subject: "freed object" error
  • From: Lorenzo <email@hidden>
  • Date: Thu, 30 Mar 2006 00:58:22 +0200

Hi,
not always, when I call a method, I get a "freed object" error.
----------------------------
malloc: *** error for object 0x1a1dc00: incorrect checksum for freed object
- object was probably modified after being freed, break at szone_error to
debug. My_Application(4764,0xa000ed68) malloc: *** set a breakpoint in
szone_error to debug
----------------------------

I checked my code but it seems that the object is not modified anywhere. I
have been debugging one day long without result. I don't know how to use the
debugger in this case. What I do is allocating a float** so I can later use
myObj[a][b]. Any time 'b' changes, I realloc the pointer myObj this way:


- (void)reallocObj
{
    [self releaseObj];

    myObj = malloc(kTotObjects * sizeof(float*));
    if(myObj != nil)
    {
        int        i, totValues = x * y + k;
        for(i = 0; i < kTotObjects ; i++)
        {
           myObj[i] = malloc(totValues * sizeof(float));       // error here
           if(myObj[i] == nil)  NSLog(@"myObj[%d] == nil", i); // never got
        }
    }
}


- (void)releaseObj
{
    if(myObj != nil){
        int i;
        for(i = 0; i < kTotObjects ; i++)
        {
            free(myObj[i]);
            myObj[i] = nil;
        }
        free(myObj);
        myObj = nil;
    }
}


How to fix this bug?
How to retrive the object/method who is modifying myObj?


Best Regards
--
Lorenzo
email: email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Dragging promised files to finder behaviour question
  • Next by Date: NSPopUpButton + NSArrayController: always adds the 'No Value' item at the bottom of other values.
  • Previous by thread: Re: confused about inheritance
  • Next by thread: NSPopUpButton + NSArrayController: always adds the 'No Value' item at the bottom of other values.
  • Index(es):
    • Date
    • Thread