• Register
0 votes
1.2k views

Problem :

I am facing the following error :

malloc: *** error for object 0xa68aca0: pointer being freed was not allocated

*** set a breakpoint in malloc_error_break to debug

I have already set the Symbolic Breakpoint, Still Nothing happens on the console, Not getting any hint from the console.

I am having xcode 4.6

Does anybody have any clue about the error?

6 5 3
7,540 points

2 Answers

0 votes

Solution :

I have lots of industry experience in writing complex code.

I have gone through your post and understood your problem.

So to begin with you must follow below approach to resolve your issue:.

I think you are releasing the object too many times.

So to solve this please open up your debugger console by pressing combination of Cmd+Shift+R. and after doing that please type in the following code:

break malloc_error_break

Above mentioned code will set a breakpoint at the beginning of your malloc_error_break, After doing that you can also try to do print out and understand what is the object at 0xa68aca0 by using following code.

print-object 0x1068310

9 7 4
38,600 points
0 votes

Solution:

The issue is with this code:

parent.left = &a;
parent.right = &b;

This is getting pointers to local variables, which will be reinitialized next time on all direction the loop. CharCountNode will al last attempt to delete these objects, however they haven't been allocated by new.

You require to make left and right point to objects allocated on the heap, as that is what CharCountNode is expecting. Something like:

parent.left = new CharCountNode(a);
parent.right = new CharCountNode(b);

You require to include this to just earlier on return dataReturn; in your dataTest function:

dataReturn[i] = NULL ;

Else your while (data[i]) {} will continue further than wanted.

And instead of:

dataReturn[i] = malloc( sizeof(char) * (strlen(*str)) );

write:

dataReturn[i] = malloc(strlen(*str) + 1);

With a view to allocating space for the terminating zero.

BTW sizeof (char) is always 1.

python 3.6 malloc: pointer being freed was not allocated / set a breakpoint in malloc_error_break to debug Abort trap: 6

 

10 6 4
31,120 points

Related questions

1 vote
1 answer 148 views
148 views
Problem : I am beginner to Angular Js. I am trying to learn the AngularJS. Below is my code from my controllers.js file. 'use strict'; angular.module ( 'F1FeederApp.controllers' , [ ] ) .controller ( 'driversController' , function ( $myscope , myergastAPIservice ) ... url not allowed by $sceDelegate policy” I am unable to figure out the cause of this error. Can someone guide me in fixing it?
asked Mar 27 morrisBson 3.2k points
1 vote
1 answer 190 views
190 views
Problem : I have the big trouble with the iOS App: it just crashes sometimes without detailed debug error. The stack trace is also empty. Below are the only two lines in the stack trace: 1. Crash start in UIApplicationMain at "symbol stub for: - ... breakpoint in malloc_error_break with the libsystem_c.dylib without any feedback from the debugger. I have no idea regarding how to solve this issue.
asked Dec 16, 2019 alecxe 7.5k points
0 votes
1 answer 464 views
464 views
Problem : I have a serious issue with my iOS App: it crashes manytimes without detailed debug error. My stack trace is empty. Below are the only two lines in my stack trace: a. Crash start in UIApplicationMain at "symbol stub for: -[ ... breakpoint in malloc_error_break with the libsystem_c.dylib but without any feedback from debugger. I have no idea how can I solve this issue.
asked Dec 7, 2019 alecxe 7.5k points
1 vote
1 answer 241 views
241 views
Problem : I am facing bellow strange error undefinedmetricwarning: precision is ill-defined and being set to 0.0 due to no predicted samples.
asked Nov 8, 2019 peterlaw 6.9k points