POV-Ray : Newsgroups : povray.programming : and another one, possible memory leak : Re: and another one, possible memory leak Server Time
28 Jun 2024 01:41:34 EDT (-0400)
  Re: and another one, possible memory leak  
From: Mike Raiford
Date: 29 Oct 2004 08:33:26
Message: <41823896$1@news.povray.org>
Daniel Hulme wrote:

> Yes, it did both of these:
>     New = Create_Interior();
> 
>     *New = *Old;
> 
> It then goes on to do some deep copying. Now, I may be mistaken, but I
> was under the impression that *x = *y did a shallow copy. Since the
> reference count is an int and not an int*, that means the reference
> count is copied, over the existing count of 1.

If there is no copy constructor and no operator=, it does a memberwise 
copy. Same as memcpy(New,Old,sizeof(struct)).

-- 
~Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.