|
|
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
|
|