POV-Ray : Newsgroups : povray.beta-test : Out of Memory Error while using Bounding Method 2 : Re: Out of Memory Error while using Bounding Method 2 Server Time
28 Jul 2024 20:30:05 EDT (-0400)
  Re: Out of Memory Error while using Bounding Method 2  
From: Warp
Date: 14 Jan 2007 08:36:34
Message: <45aa31e1@news.povray.org>
Chris Cason <del### [at] deletethistoopovrayorg> wrote:
> I've tested this with your scene and in fact it is a genuine memory error;
> due to the way the STL (a library we use) works, it attempts to allocate a
> very large array to move an existing array that it needs to expand, and this
> is what is failing (the request is for hundreds of megabytes).

  Is this the case with std::vector?

  You should consider using std::deque instead, or an implementation of the
same idea.
  In a work project I actually had the exact same problem: I used std::vectors
for the main data containers, items were continuously being added to these
vectors, and they consumed a lot more memory than expected. I discovered
this one day when I measured the memory consumption of the program and
compared it to the theoretical minimum that it must take to work: The
real consumption was almost twice bigger!
  I immediately knew that the problem was with std::vector. I implemented
my own vector data container which used the same idea as std::deque uses,
but simplified, and the memory consumption immediately dropped dramatically,
and got much closer to the theoretical minimum. The speed of the program
did not suffer at all.

-- 
                                                          - Warp


Post a reply to this message

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