• 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: "Ray, Jeffrey R. {Jeff}(DFRC-ME)" <email@hidden>
  • Date: Mon, 12 Sep 2011 13:02:54 -0500
  • Acceptlanguage: en-US
  • Thread-topic: Error on deleting pointer

On 9/12/11 7:49 AM, "Jos Timanta Tarigan" <email@hidden> 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
> };
>

This won't help you with finding where the problem is, but you might
consider adopting the coding style of setting invalid pointers to zero:

if(pointer){
    delete pointer;
    pointer = 0;
}

This gets rid of the reported error, and if you add a bit of debugging code
around at the delete(s), it might help track down where the extra delete is
coming from.

What exactly are you doing with bgArr?  Are you passing it to some library
that thinks it now owns it, and might be deleting it without your knowledge?

-j

------------------------------------------------------------------
Jeff Ray M/S 4840A              Official Correspondence Only:
NASA                                             email@hidden
Dryden Flight Research Center               email@hidden
P. O. Box 273
Edwards, CA 93523-0273          All Others:        email@hidden
(661) 276-3754



 _______________________________________________
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

  • Follow-Ups:
    • Re: Error on deleting pointer
      • From: Sean McBride <email@hidden>
    • Re: Error on deleting pointer
      • From: Scott Ribe <email@hidden>
References: 
 >Re: Error on deleting pointer (From: Jos Timanta Tarigan <email@hidden>)

  • Prev by Date: Setting Debug Mode?
  • Next by Date: Re: Error on deleting pointer
  • Previous by thread: Re: Error on deleting pointer
  • Next by thread: Re: Error on deleting pointer
  • Index(es):
    • Date
    • Thread