• Register
0 votes
1.8k 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

Please log in or register to answer this question.

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

0 votes
1 answer 13 views
0 votes
1 answer 13 views
13 views
Problem: I'm doing some homework for an OOP class and I've been stuck for a good hour now. I'm getting this error once I've used keyboard input enough. I am not someone who gets frustrated at all, and here I am getting very frustrated with this.
asked Dec 13, 2020 Mashhoodch 9.6k points
0 votes
1 answer 4 views
4 views
Problem: itunes was unable to load dataclass information from sync services.
asked Feb 13 Shovo210 3.1k points
1 vote
1 answer 302 views
302 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, 2020 morrisBson 3.2k points
1 vote
1 answer 515 views
515 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 658 views
658 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 602 views
602 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
0 votes
1 answer 230 views
0 votes
1 answer 11 views
11 views
Problem: commanderror: you must set settings.allowed_hosts if debug is false.
asked Feb 13 Shovo210 3.1k points
0 votes
1 answer 161 views
161 views
Problem : I am very new to Shell scripting. Currently I am trying to write the Shell Script which should create some dirs on my remote server and then it should use the scp to copy the files from the local pc on the remote server. But whenever I try to ... Pseudo-terminal will not be allocated because stdin is not a terminal.” And my script hangs after the message. How to fix above message?
asked Feb 24, 2020 mphil 2.3k points