Re: Array object operator overloading

From: Ivan Vecerina (NOT_VALID_please_use_contact_webform_at_vecerina.com)
Date: 01/27/05


Date: Thu, 27 Jan 2005 14:28:33 +0100


"Ramprasad A Padmanabhan" <ramprasad.padmanabhan@oracle.com> wrote in
message news:41F8EB2E.6020101@oracle.com...
> I thought I should bother about memory leak later , So I dropped my
> destructor.
> Now my code is working fine. So how do I free the memory allocated to int
> *data
As Ron and I pointed out, the problem is not (just) the destructor,
but the copy-constructor and copy-assignment operator that you need
to implement as well.
But you don't need to bother, just use std::vector ( or std::valarray ).

-- 
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form


Relevant Pages

  • Re: CList Concept
    ... pointer instead of a list of object. ... called automatically by the list class destructor. ... CObject myObject = new CObject; ... if I do it this way, will I get memory leak? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: CList Concept
    ... there is a bunch of predefined collection classes for standard ... called automatically by the list class destructor. ... CObject myObject = new CObject; ... if I do it this way, will I get memory leak? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: static object destructor not getting called
    ... The memory leak report comes out before static objects are destructed. ... For some reasons its destructor is not getting called, ...
    (microsoft.public.vc.mfc)
  • Re: Delegated Interface
    ... >> destructor is no longer called and i get a memory leak. ... >> you have an explanation for that behaviour? ... Or for a quick and dirty approximation of MemProof, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Delphi 2006, Possible to go back to old memory manager?
    ... >> and therefore not worth the bother to hunt down and destroy. ... >Every memory leak or dangling pointer is evil incarnate. ... I hope that no-one is proud of releasing ...
    (borland.public.delphi.non-technical)