POV-Ray : Newsgroups : povray.animations : System resources depleted in animations Server Time
24 Nov 2024 00:35:14 EST (-0500)
  System resources depleted in animations (Message 1 to 5 of 5)  
From: Bosley
Subject: System resources depleted in animations
Date: 18 Mar 2003 19:55:03
Message: <web.3e77bf1a44ee95aa950c09400@news.povray.org>
I am having a problem with POV-Ray, and I wanted to talk it out here,
because I am not sure if it is a problem with POV-Ray, or with my coding.
I am doing a POV house (on and off for quite a while) and reciently got
back in the swing of things with POV 3.5.  I have not reciently measured
the size of the codebase I am working with, but rest assured it is at least
2k lines of well formated text.  The codebase is subdivided into multiple
include files (walls.inc, ceilings.inc, Household_objects.inc etc), all
called by a master file which place the items in space. Since I am getting
to the point of furnishing the house, I wanted to easily be able to
generate multiple views of the house so I could easily keep track of what I
needed to proceed in terms of furniture.  I set an animation loop where
each frame references a different set of camera and look_at coordinates.
From there, I set up an OLE document in my word processor that, with a
click of the mouse, replaced all 43 views of my interior with up-to-date
pictures.  This was not a problem.  I have it working great.  But
reciently, I rendered the animation loop, and it gave me a virtual memory
warning.  I am enough of a geek that I was mildly concerned.  My system,
while not exactly a power rig any more, should have been more than a match
for what I was doing.  I have a P2 350MHZ, 128 MB running Win2k Pro.  I
opened up the performance monitor supplied by Win2k and setup counters for
% Processor usage, Physical memory availible, % of Pagefile in use, and
number of pages per second.  I reran the animation series, and found the
pattern that has distressed me a touch.

From my understanding of the POV-Ray documentation, the animation loop works
something along the lines of: 1) Parse program 2)Render Picture 3) Write
image file, 4)purge and reset for next frame, 5) repeat through all frames.
 Thus, what I would expect this to translate to in terms of the performance
counters I had set up was:
1) the Processor usage should run maxed out.  It is either rendering or
parsing, both of which should be maxing out the processor, with perhaps
small breaks while it waits for the hard drive to write the image file.
2) Physical Memory should be in a cyclic, but constant, pattern, shrinking
during the parse as data is compliled, and regrowing as the frame is purged
before the next frame.
3)Pagefile should not be in excessive use because while I have a fairly
large codebase, it sure isn't the 90MB of physical memory or so Win2k
leaves me.

The pattern I found was
1) During normal rendering operations, the processor ran maxed out.  No Duh.
2) Physical memory was in a cyclic pattern, but it was not constant.  The
initial hit I took at the start of a frame cycle was around 20 MB (about
what I expected), but during the purge and reset phase, I was only
recovering ~14 MB.  Thus, over the life of the animation loop, I was slowly
eating up all my memory in this memory leak.  Oviously, as the animation
loop progressed, I reached levels where the pagefile was starting to be
needed, and the counters reflect this, showing an increase of use of
pagefile space.  Near the end of the animation loop, the swaping of memory
between physical memory and pagefile began to affect processor usage.  The
processor was dropping to mid-utilization while it did all the swapping
back and forth with the pagefile.  And at the end of the animation loop, I
noticed a long period (5min?) of time where POV seemed hung-up, but upon
looking at the counters, it was processing the contents of the pagefile. At
the very end of the animation loop, system resources are returned to
starting levels.

Now I come to the question that I need you folks for.  Do you think this is
a problem with the POV-Ray distribution, a small code leak compounded to
noticability by a large codebase parsing repeated over and over for the
animation?  Or is there some trick to the POV language I am ignorant of?  I
do alot of #declares, but I would think that those would be erased between
frames.  I use some loops, but again, any residue should be purged between
frames.  I cannot account for any other factors that would fit the facts.

I know this is a long post, and very technical.  However, I do not want to
harang the POV-Team with a "You got a problem, duuude" post until I can
eliminate myself and my work from the equation.  I just need some help
brainstorming possible flaws with my coding.  I have a screen capture of
the Performance monitor for anyone else who cares to interpret it, and if
it is nessesary, I can zap my code base off to someone for review.  Just
let me know what further information you need.

Thanks for the help,
Bosley
(dillender@#no-spam#bigmailbox.net)


Post a reply to this message

From: Christoph Hormann
Subject: Re: System resources depleted in animations
Date: 19 Mar 2003 03:32:10
Message: <3E782B0A.4A25BB90@gmx.de>
Bosley wrote:
> 
> Now I come to the question that I need you folks for.  Do you think this is
> a problem with the POV-Ray distribution, a small code leak compounded to
> noticability by a large codebase parsing repeated over and over for the
> animation?  Or is there some trick to the POV language I am ignorant of?  I
> [...]

Well, i obviously can't answer your question because i did not see your
code but there are a few things you should bear in mind:

- the OS system monitor is no good indication for whether there is a
memory leak in POV-Ray or not.
- if you want to trace down the problem (no matter whether it's a SDL code
problem or an internal POV-Ray problem) you should remove one part of the
scene after the other and see if the problem persists.
- The POV-Ray source code contains some mechanism for tracking down memory
problems, if you have experience with C programming and compiling you can
try to use it.  
- If you want the POV-Team to have a look at this problem a minimal test
scene will be required.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Remco de Korte
Subject: Re: System resources depleted in animations
Date: 19 Mar 2003 10:35:34
Message: <3E788E00.8AB1A7A4@onwijs.com>
Bosley wrote:
> 

Summarizing: there is a memory leak. 
I have noticed this in animations, especially with lots of frames or
complicated scenes. I couldn't really find a pattern (didn't really look
for it) but my guess is it isn't necessarily a leak in POVRay, it may
also be a memory allocation bug in Windows. I have noticed something
similar in a program I made where lots of images were constantly created
and destroyed: it slowly ate up memory. Nothing in the code could avoid
this (a simple loop create-destroy was enough to see this behaviour). If
this is indeed platform specific it would be very hard to solve.

Remco


Post a reply to this message

From: Bosley
Subject: Re: System resources depleted in animations
Date: 27 Mar 2003 16:25:07
Message: <web.3e836b4b42ea70b950c09400@news.povray.org>
I was able to isolate the worst of the problem.  Below is a .POV file that
demonstrates it.  I was originally hoping to send the files as attachments,
but due to my situation, I must use the webview of the newsgroups where
that is prohibited.  There is one problem with sending the code this way.
You need a gif named Book1.gif.  I can provide mine on request with an
email, but I do not believe it is specific to that gif.

Two files are included below.  The first is the .ini file I used to create
the animation loop.  The second is the .POV.

####POV Specials.ini####
[Allview Generator]
;; Set frame output options
Width=320
Height=240
Antialias=Off

;; Set file output options
Output_to_File=on
Output_File_Type=S ;;BMP output
;;Output_File_Type=N ;;PNG output
Output_File_Name=f:\povart working images\Povhouse#3 Allviews\

;; Set animation options
Initial_Clock=1.0
Final_Clock=43.0
Final_Frame=43

;; Frame Selection
Subset_Start_Frame=1.0
Subset_End_Frame=20.0

[Experimental 360]
width=800
height=240
antialias=off

#####END of POV Specials.ini#####

####Scratch.POV######
/*Demonstration of problem:

        Here is a scene sample that demonstrates my problem.  It is a
bookcase whose book's spines reference GIFs for their texture.
        When I render this scene, system memory is gobbled up at an alarming
rate.  While I am not expert enough to absolutely absolve myself of fault,
I am confident this is a
        legitimate bug since POV does not Red Flag any errors while parsing.

        I believe the error to reside in this line:
                texture{pigment{image_pattern{gif "Book1.gif"}

        In my coding, I have the random number generator pick a random book
spine image, using a #switch structure.  Below, I have highlit
        the place where this switch can be determined. When the Book_Pattern
varible is set to a legal value or allowed to reference the
        random number generator, the bug is invoked.  However, when it is
set to 0 (or any other unspecified value), causing the above line
        not to be parsed, the undesired behavior does not occour.

*/
#include "colors.inc"
#include"skies.inc"
camera{
                        location<10,10,-10>
                 look_at<0,3,0>
                 }

// Exterior Lights
//light_source{<-30,38,25> color White }//shadowless}
light_source{<90,27,-90> color White shadowless}
//light_source{<-30,48,-25> color White }//shadowless}
light_source{<-50,58,27.25> color White shadowless}

// interior lights
light_source{<2,1.7,4+.01> color Gray85}
light_source{<-6,15,14> color Gray90}

// Environment
sky_sphere{S_Cloud3}
plane{ y,-.5
 texture{pigment{DarkGreen}}}

// Structure
#local Bookcase_Height=7;
#local Upvec=y;
#local Bookcase_Width=9;
#local Width_Vec=-z;
#local Bookcase_Depth=1;
#local Depth_Vec=-x;
#local Horz_Partions=6;
#local Vert_Partions=4;
#local Divider_Width=.75/12;
#local Base_Height=3/12;

#local Seed=seed(61274);//seed(42795);
#local Max_Book_Depth=10/12;
#local Min_Book_Depth=4/12;
#local Max_Book_Height=1;
#local Min_Book_Height=7/12;
#local Max_Book_Width=4/12;
#local Min_Book_Width=.5/12;
#local Percent_Full=.945;

#local Partion_Height=(Bookcase_Height-Base_Height)/Horz_Partions;
#local Partion_Width=Bookcase_Width/Vert_Partions;
#if (Max_Book_Height>Partion_Height)
        #local Max_Book_Height=Partition_Height;
        #end
#if (Max_Book_Depth>Bookcase_Depth)
        #local Max_Book_Depth=Bookcase_Depth;
        #end

union{  union{
polygon{5,<0,0,0>,Bookcase_Height*Upvec,Bookcase_Height*Upvec+Bookcase_Width*Width_Vec,Bookcase_Width*Width_Vec,<0,0,0>
                        translate 1/24*Depth_Vec
                        }

box{<0,0,0>,Base_Height*Upvec+Bookcase_Width*Width_Vec+Bookcase_Depth*Depth_Vec}

box{<0,0,0>,Bookcase_Height*Upvec+Divider_Width*Width_Vec+Bookcase_Depth*Depth_Vec}

box{Bookcase_Width*Width_Vec,Bookcase_Height*Upvec+(Bookcase_Width-Divider_Width)*Width_Vec+Bookcase_Depth*Depth_Vec}

box{Bookcase_Height*Upvec,(Bookcase_Height-Divider_Width)*Upvec+Bookcase_Width*Width_Vec+Bookcase_Depth*Depth_Vec}
        //Verical Dividers
                #local c=Vert_Partions-1;
                #while(c>=1)

box{<0,0,0>,Bookcase_Height*Upvec+Divider_Width*Width_Vec+Bookcase_Depth*Depth_Vec
                                translate Partion_Width*Width_Vec*c
                                }
                        #local c=c-1;
                        #end
        //shelves
                #local c=Horz_Partions-1;
                #while(c>=1)

box{Bookcase_Height*Upvec,(Bookcase_Height-Divider_Width)*Upvec+Bookcase_Width*Width_Vec+Bookcase_Depth*Depth_Vec
                                translate -Partion_Height*Upvec*c
                                }
                        #local c=c-1;
                        #end
                texture{pigment{White}//T_Wood14
                        scale .5
                        }
                }
//Books
        #local c2=0;
        #while (c2<Vert_Partions)
                #local c1=0;
                #while (c1<Horz_Partions)
                        #local c=Divider_Width;
                        #while(c<Partion_Width-Divider_Width)
                                #local
Book_Depth=(Max_Book_Depth-Min_Book_Depth)*rand(Seed)+Min_Book_Depth;
                                #local
Book_Height=(Max_Book_Height-Min_Book_Height)*rand(Seed)+Min_Book_Height;
                                #local
Book_Width=(Max_Book_Width-Min_Book_Width)*rand(Seed)+Min_Book_Width;
                                #local
Book_Color=<rand(Seed),rand(Seed),rand(Seed)>;

//***** Critical varible for forking:
//      set Book_Pattern to 0 to bypass bug, 1-9 for forcing the selction to
all books,and edit line for my ramdom selector

                                #local Book_Pattern=1;//ceil(rand(Seed)*9);
//*****

                                #if (c+Book_Width<Partion_Width)

box{<0,0,0>,Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec
                                                #switch(Book_Pattern)
                                                        #case(1)

texture{pigment{image_pattern{gif "Book1.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(2)

texture{pigment{image_pattern{gif "Book2.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(3)

texture{pigment{image_pattern{gif "Book3.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(4)

texture{pigment{image_pattern{gif "Book4.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(5)

texture{pigment{image_pattern{gif "Book5.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(6)

texture{pigment{image_pattern{gif "Book6.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(7)

texture{pigment{image_pattern{gif "Book7.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(8)

texture{pigment{image_pattern{gif "Book8.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #case(9)

texture{pigment{image_pattern{gif "Book9.gif"}

   rotate -90*y

   scale Book_Depth*Depth_Vec+Book_Height*Upvec+Book_Width*Width_Vec

   }
                                                                        }
                                                                #break
                                                        #end
                                                 texture{pigment{color
Book_Color
                                                                filter .9
                                                                }
                                                        }

                                                        translate
(c1*Partion_Height+Base_Height)*Upvec+(c2*Partion_Width+c)*Width_Vec
                                                }
                                        #end
                                #local c=c+Book_Width;
                                #if (rand(Seed)>Percent_Full)
                                        #local c=Partion_Width;
                                        #end
                                #end
                        #local c1=c1+1;
                        #end
                #local c2=c2+1;
                #end
        }

#### End scratch.pov #####

I hope having to cut and paste this does not corrupt the file.  If
nessesary, I can email any of the above files or results on request.
>
>Thanks for the help,
>Bosley
>(dillender@#no-spam#bigmailbox.net)
>


Post a reply to this message

From: Remco de Korte
Subject: Re: System resources depleted in animations
Date: 27 Mar 2003 17:36:06
Message: <3E837CAE.F0B386DC@onwijs.com>
Bosley wrote:
> 
> I was able to isolate the worst of the problem.  Below is a .POV file that
> demonstrates it.  I was originally hoping to send the files as attachments,
> but due to my situation, I must use the webview of the newsgroups where
> that is prohibited.  There is one problem with sending the code this way.
> You need a gif named Book1.gif.  I can provide mine on request with an
> email, but I do not believe it is specific to that gif.
> 
> Two files are included below.  The first is the .ini file I used to create
> the animation loop.  The second is the .POV.
> 

Have you tried it without the image maps?

Remco


Post a reply to this message

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