• 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
Re: Error on deleting pointer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error on deleting pointer


  • Subject: Re: Error on deleting pointer
  • From: "Glenn L. Austin" <email@hidden>
  • Date: Mon, 12 Sep 2011 20:33:20 -0700

Define a private copy constructor and private assignment operator and see if your program even compiles.

I'll bet that you have a copy somewhere that you're not aware of. If you have a bare pointer in a data structure, you'd better be declaring a copy constructor and assignment operator!

On Sep 12, 2011, at 7:49 AM, Jos Timanta Tarigan wrote:

Hi, 

I seems not to understand what went wrong with my code. I use guard malloc and it catches this error when I delete the pointer in the destructor of an object. 

~ObjectX() {
        delete [] bgArr; // malloc error occured here
};

When I run it without guard malloc, the code runs, but the console prints the error. 
But when I try to simulate/reproduce it in a much smaller code, I cant reproduce the error. Its a little bit confusing.

I googled it and it seems like most result return an OSX/iOS/XCode related. Is there a chance that its a bug on XCode/Compiler? I'm using XCode 4.0 Snow Leopard with LLVM GCC 4.2. 


-- 
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
"Where there's breath, there's hope!"
<http://www.austin-soft.com>

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

This email sent to email@hidden

References: 
 >Error on deleting pointer (From: Jos Timanta Tarigan <email@hidden>)
 >Re: Error on deleting pointer (From: Jens Alfke <email@hidden>)
 >Re: Error on deleting pointer (From: Jos Timanta Tarigan <email@hidden>)

  • Prev by Date: Re: Setting Debug Mode?
  • Next by Date: Re: Xcode 4.1: Sorting files in groups
  • Previous by thread: Re: Error on deleting pointer
  • Next by thread: Where is Customize button in Xcode 4.1 installer?
  • Index(es):
    • Date
    • Thread