[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: problems with PCB and large board



On Wed, 2008-12-24 at 12:57 +0000, Peter Clifton wrote:
> On Wed, 2008-12-24 at 07:02 -0500, gene wrote:

> > OK, if I run the program normally, it'll crash with the segmentation 
> > error.  If I run it under valgrind - it doesn't crash.  When the rats 
> > appear, they completely flood the screen, making it one big mass of 
> > bronze color.  I was able to turn off the rats and see my components. 
> > Finally, I closed out without saving.  If you still want to use my 
> > layout, I will send it to you - it's probably going to be more efficient 
> > to solve the problem.  Here's the valgrind output:
> 
> Sure, send the board to me. I'll treat it as confidential and delete it
> afterwards.

Ok, hold that thought for a moment..

Try the attached patch (should fix the issue).
Valgrind is a wonderful tool ;)

If it stops the crash, could you just confirm for me that valgrind is
then happy, and doesn't report any problems.

Best wishes,
> 
-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
From aa6797de10a632ad82c786536df494f5031e8c04 Mon Sep 17 00:00:00 2001
From: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Wed, 24 Dec 2008 13:05:31 +0000
Subject: [PATCH] Fix regenerate rats r-tree after re-allocating a new rat array

Fixes crashes observed on a board with a large number of rats.
---
 src/mymem.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mymem.c b/src/mymem.c
index f6b6957..cb481b4 100644
--- a/src/mymem.c
+++ b/src/mymem.c
@@ -305,10 +305,19 @@ GetRatMemory (DataTypePtr Data)
   if (Data->RatN >= Data->RatMax)
     {
       Data->RatMax += STEP_RAT;
+      /* all of the pointers move, so rebuild the whole tree */
+      if (Data->rat_tree)
+        r_destroy_tree (&Data->rat_tree);
       rat = MyRealloc (rat, Data->RatMax * sizeof (RatType),
 		       "GetRatMemory()");
       Data->Rat = rat;
       memset (rat + Data->RatN, 0, STEP_RAT * sizeof (RatType));
+      Data->rat_tree = r_create_tree (NULL, 0, 0);
+      RAT_LOOP (Data);
+      {
+        r_insert_entry (Data->rat_tree, (BoxTypePtr) line, 0);
+      }
+      END_LOOP;
     }
   return (rat + Data->RatN++);
 }
-- 
1.6.0.4


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user