pcb

PCB from git head dies on optimize rats

Bug #792139 reported by KaiMartin
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pcb
Fix Released
Undecided
Andrew Poelstra

Bug Description

The optimize rats action of PCB seems to have suffered from changes since version 20100929. With a fairly large layout (1700 components) the application dies repeatedly after two to three optimize actions. There is an error message on the command line:

***MEMORY-ERROR***: pcb-PC[19621]: GSlice: failed to allocate 248 bytes (alignment: 256): Cannot allocate memory

During optimize system load goes way up and memory usage goes beyond 2GB and into swap. The memory does not seem to be freed when optimize is done. After the second ooptimize memory usage rises even more until the application dies. See the attached screenshot of the system monitor.

The same layout does not crash with PCB v20100929. With this version optimize rats takes just two seconds and is not visible in memory usage. Peter Cliftons current pcb+gl crashes like git head.

---<)kaimartin(>---

Tags: git-head
Revision history for this message
KaiMartin (kmk-familieknaak) wrote :
Revision history for this message
KaiMartin (kmk-familieknaak) wrote :
tags: added: git-head
Revision history for this message
Andrew Poelstra (asp11) wrote :

There is definitely a memory problem here. With my system (2Gb RAM, no swap) I can crash pcb with a single optimize.

The memory spike also occurs when compiling with --disable-gl, so it seems that Peter C.'s GL changes are not to blame.

Changed in pcb:
assignee: nobody → Andrew Poelstra (asp11)
status: New → Confirmed
Revision history for this message
Andrew Poelstra (asp11) wrote :

Attached patch that (I think) fixes this bug. Will post on mailing list for review.

Andrew Poelstra (asp11)
Changed in pcb:
status: Confirmed → In Progress
Revision history for this message
gpleda.org commit robot (gpleda-launchpad-robot) wrote :

Bug was fixed by a commit
git master commit d30d31425fa318390e4632d5063e6bb655b01793
http://git.gpleda.org/?p=pcb.git;a=commit;h=d30d31425fa318390e4632d5063e6bb655b01793

commit d30d31425fa318390e4632d5063e6bb655b01793
Author: Andrew Poelstra <email address hidden>
Commit: Andrew Poelstra <email address hidden>

    Remove memory allocation from src/macro.h

    When we started using GLists for various objects, we
    also changed the looping macros to allocate copies of
    the list in order to avoid problems with list integrity
    in case items were removed during the iteration.

    However, this caused memory leaks whenever there was an
    early return from the middle of the list. Bug lp-792139
    shows pcb using over 2Gb of memory and crashing when
    optimizing rats on a large board.

    This patch saves the next pointer before the loop body,
    rather than allocating a whole new list, to handle element
    deletions.

    Closes-bug: lp-792139

Changed in pcb:
status: In Progress → Fix Committed
Revision history for this message
KaiMartin (kmk-familieknaak) wrote :

I can confirm, the bug is fixed in current git head.
This means, I can actually use the accelerated version of PCB for my current rather large project -- The one attached above.

Thank you for the speedy fix!

---<(kaimartin(>---

Peter Clifton (pcjc2)
Changed in pcb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.