![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39b66c38@news.povray.org>, Warp <war### [at] tag povray org>
wrote:
> Strange. I don't use new anymore (except only in very few cases) since
> the STL is so handy.
>
> Why would I code dynamic vectors, trees and so on myself when someone
> much more expert than me has done it already? And besides, STL is a lot
> easier to use :)
Why would I use code from someone else for something as simple as a
linked list or tree?
Ok, much of the problem is that I can't find a good reference about the
best way to use the STL, and templates have been nothing but headaches
to me.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Rune" <run### [at] iname com> writes:
> "Chris Huff" wrote:
> > Probably a memory leak,
>
> I don't know exactly what a memory leak is, but I can tell you some more
> about how MP+ behaved in my case.
>
> Well, I have this animation that doesn't use any MP+ features at all. When I
> render it in regular MP everything is fine and the peak memory used is about
> the same for every frame.
> But when I render the same animation in MP+ the peak memory used increases
> rapidly for every frame, like they are added together.
This is exactly a memory leak: Memory, that has been allocated, is not
freed when it isn't used any more. That's why the program seems to use
more and more memory during its run.
If you render only a single frame, all memory is freed (returned to the
operating system) when the program ends. By this the memory leak isn't
so apparent.
A "modern" explanation of memory leaks might go like this: Instead of
recycling memory it is thrown away. :-)
Thomas
--
http://www.thomas.willhalm.de/ (includes pgp key)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <chrishuff-A5A55D.12215206092000@news.povray.org> , Chris Huff
<chr### [at] mac com> wrote:
> Why would I use code from someone else for something as simple as a
> linked list or tree?
Because the someone else put a lot of R&D into it and optimised the code for
your platform, while you have to optimise it yourself otherwise...
> Ok, much of the problem is that I can't find a good reference about the
> best way to use the STL, and templates have been nothing but headaches
> to me.
Well, then just use trial and error. Start with simple types like strings,
vectors and lists first. Use them in simple cases, play around with them,
and whenever something does not work as expected, try to find out why, don't
just give up. Don't be afraid, just try - that is how I got started with
it after reading Stroustrup's book :-)
As for books, there are a few in the Addison-Wesley Professional Computing
Series for example (yes, they are expensive, but you can learn a lot from
them, and some will surely be available in your local college library).
Of course there is the Stroustrup "The C++ Programming Language 3rd Ed."
which explains at least the basic types mentioned above well enough to use
them, and it also explains templates. For understanding the complex object
oriented models behind lots of libraries (not just the STL, but also i.e.
most GUI frameworks) try the classic book "Design Patterns: Elements of
Reusable Object-Oriented Software".
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote in message ...
>I suspect there are a couple leaks in the expression
>parsing functions, and maybe two which I added by mistake with the
>turbulence scale patch, but I seem to have been getting leaks since my
>first compile of MegaPOV 0.5a, so it isn't only my code at fault. There
>are probably dozens of small leaks scattered all over the source code.
Last year I went through POV-Ray for Windows (the SuperPatch version) and
got rid of every memory leak the memory-logging function could find. Most
of the leaks were in SuperPatch features. The ones I have the fixes for
are:
Spline memory leak
-- Add the following lines to the end of Destroy_Ident_Data
case SPLINE_ID_TOKEN:
Destroy_Spline((SPLINE *)Data);
break;
Memory leak in File:C:\Temp\workarea\SOURCE\Matrices.c Line: 986 Size:256
--Problem occurs when a declared object (HF?) is scaled and then instanced
-- THE BUG: COPY_OBJECT_FIELDS copies the UV_Trans for an object, but
Copy_Object also does this. The fix: remove the call in Copy_Object.
One warning about the memory log feature: It results in about a 30%
slowdown in rendering SkyVase. Be sure to turn it off when compiling a
release version.
Mark
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
>
> Ok, much of the problem is that I can't find a good reference about the
> best way to use the STL, and templates have been nothing but headaches
> to me.
>
Two links for the STL:
http://codeguru.earthweb.com/cpp/stlguide/index.shtml
http://www.sgi.com/Technology/STL/
And a genral book about C++ with (among other things) a good
introduction to templates:
http://codeguru.earthweb.com/cpp/tic/index.shtml
--
* Doctor Jekyll had something * mailto:ber### [at] iname com
* to Hyde... * http://www.enst.fr/~jberger
*******************************
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39b72862@news.povray.org>, "Mark Wagner"
<mar### [at] gte net> wrote:
> Last year I went through POV-Ray for Windows (the SuperPatch version) and
> got rid of every memory leak the memory-logging function could find.
> Most of the leaks were in SuperPatch features. The ones I have the
> fixes for are:
I added these fixes to my version, thanks!
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39b6892f@news.povray.org>, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> Because the someone else put a lot of R&D into it and optimised the
> code for your platform, while you have to optimise it yourself
> otherwise...
Aw, takes all the fun out of it! ;-)
> Well, then just use trial and error. Start with simple types like
> strings, vectors and lists first. Use them in simple cases, play
> around with them, and whenever something does not work as expected,
> try to find out why, don't just give up. Don't be afraid, just try
> - that is how I got started with it after reading Stroustrup's book
> :-)
Ok...I will try. :-)
But you have seen CodeWarrior's error messages...not terribly
descriptive. I spent most of my time in the "error" portion of "trial
and error".
...misc book recommendations snipped...
Thanks, I will put these on my list of books to get.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <chrishuff-240B6F.16040107092000@news.povray.org> , Chris Huff
<chr### [at] mac com> wrote:
> Ok...I will try. :-)
> But you have seen CodeWarrior's error messages...not terribly
> descriptive. I spent most of my time in the "error" portion of "trial
> and error".
>
> ...misc book recommendations snipped...
> Thanks, I will put these on my list of books to get.
Guess what, other compilers are even worse <sigh> MrC and Visual C for
example...
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <chrishuff-240B6F.16040107092000@news.povray.org> , Chris Huff
<chr### [at] mac com> wrote:
> ...misc book recommendations snipped...
> Thanks, I will put these on my list of books to get.
See it this way: If you plan to major in CS (if you do?) you will have to
get most of them sooner or later anyway ;-)
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <chrishuff-0559FE.12183706092000@news.povray.org>, Chris
Huff <chr### [at] mac com> wrote:
> Thanks...I remember seeing this before, but it didn't occur to me that
> it could be helpful in doing this.
Well, by using this logging feature, I was able to find a couple leaks
and confirm some I had found before. Some of the leaks I haven't figured
out how to fix yet are in the UseMediaAndLightCache patch, these
variables are allocated but never released:
ShadowMediaListCacheSize
LightingMediaListCacheSize
MediaIntervalCacheSize
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |