← Back to team overview

kicad-developers team mailing list archive

cached_container and memory management: sometimes run out of memory.

 

Hi, Orson and Tom,

Sometimes, when testing large boards in OpenGL mode (for instance your
large demo board "wrs.kicad_pcb"), I had the message "out of memory"
from the CACHED_CONTAINER functions which allocate space in memory.

I am able to load the board, and it happens after some editions which
are memory consuming like refilling zone, and display 3D board on W7 32
bits which manages "only" 4 Gbytes of memory.

After investigation, I am thinking it is not a bug per se, but this
problem is due to a memory fragmentation, which happens during editions.

I noticed the memory allocation to store vertexes can reach 256 MBytes
of memory, which is a rather a large memory block.
However, during the session, each time there is a significant change,
when rebuilding the drawing data, the algorithm allocates 32 Mbytes,
then 64, then 128, then 256 Mbytes.

Of course, because the board needs always roughly the same amount of
memory, the final memory block needs always the same allocation (256 Mbytes)
My opinion is the fact during these many successive very large memory
block allocations, the available memory becomes fragmented, and can be
out of very large free blocks after many intermediate allocations.

(If I run 2 instances of Pcbnew, or Kicad + firefox + thunderbird ...,
the issue can happen with smaller memory block ).

Here is my question:
Is it possible to keep the largest allocated block during the session,
without frequently allocating intermediate blocks, to avoid the memory
fragmentation in to smaller blocks ?
And is it possible to reduce or optimize this size ?

(currently, I cannot edit wrs.kicad_pcb on W7 32 bits more than 5 minutes)

Thanks.

-- 
Jean-Pierre CHARRAS


Follow ups