Re: gEDA-user: PCB head fails with ***MEMORY-ERROR***

2011-06-05 Thread Andrew Poelstra
On Fri, Jun 03, 2011 at 04:09:46PM +0100, Thomas Oldbury wrote:
This might explain my problem with PCB+GL maybe it's just a general
problem with PCB? I have noticed that PCB can eat up about 3 GB after a
few hours of routing.


The bug appears to have been introduced by the following
commit, which had some pretty far-reaching changes:

commit 2ce35292b9e96da38cb56878005aba20891689eb
Author: Peter Clifton pc...@cam.ac.uk
Date:   Sat Apr 30 15:20:39 2011 +0100

Convert board objects to GLists of g_slice allocated memory

This enables pointers for these objects to be immutable during their
lifetime, which is a _huge_ benefit for some operations.

Having otherwise was becoming VERY tiresome, and was a perenial source
of bugs tripping up novice and experts of the codebase alike.

Due to the risks associated with modifying the structure being iterated
over, this patch makes the relevant *_LOOP macros iterate over a shallow
copy of the underlying GList. This is slight overkill for many cases,
but until we have identified which do not modify the data-structures it
is wise to keep as we are.
 


-- 
Andrew Poelstra
Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net
Web:   http://www.wpsoftware.net/andrew/



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


gEDA-user: Blog post: Porting gEDA to Guile 2.0, and future plans

2011-06-05 Thread Peter TB Brett
Hi all,

I just published a blog post in which I discuss porting to Guile 2, and ask for 
suggestions about what part of gEDA I should hack on next.  It includes a 
description of the various work-in-progress branches that I've currently got on 
the back burner, which might be of interest.

http://goo.gl/jprq0

Regards,

Peter

-- 
Peter Brett pe...@peter-b.co.uk
Remote Sensing Research Group
Surrey Space Centre



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


Re: gEDA-user: PCB head fails with ***MEMORY-ERROR***

2011-06-05 Thread Andrew Poelstra


I think I've got it. The following patch (also posted on
Launchpad) fixes the bug on my system. I am posting it here
for review and testing.

There are two leaks I fixed:

  1. ENDALL_LOOP did not free memory. Now it does.

  2. If you return early from a list using the macro.h macros,
 list memory is not freed. I added an END_LOOP_EARLY macro
 to handle this. However, there are a few problems with
 this approach:

   a. It isn't obvious, especially to new devs, that you
  need to prefix all early returns with this macro.
  Plus, it's ugly.

   b. It only works on 1-level-deep loops. Supporting double-
  or higher nesting will be very difficult with the current
  macro setup.

I dunno what should be done about this. For now, this works
and also drops pcb's increasing memory use for normal work.
(Maybe there are still leaks; I just haven't noticed yet.)
Anyway, this patch will work for now. 



diff --git a/src/macro.h b/src/macro.h
index b61f673..efcec67 100644
--- a/src/macro.h
+++ b/src/macro.h
@@ -175,6 +175,8 @@ extern int mem_any_set (unsigned char *, int);
 g_list_free (__copy);   \
   } while (0)
 
+#define END_LOOP_EARLY g_list_free (__copy);
+
 #define STYLE_LOOP(top)  do {   \
 GList *__copy = NULL; /* DUMMY */   \
 Cardinal n; \
@@ -328,7 +330,11 @@ extern int mem_any_set (unsigned char *, int);
{   \
point = (polygon)-Points[n]
 
-#define ENDALL_LOOP }} while (0);  }} while (0)
+#define ENDALL_LOOP }  \
+  g_list_free (__copy);\
+} while (0); } \
+g_list_free (__copy);  \
+  } while (0)
 
 #defineALLPIN_LOOP(top)\
 ELEMENT_LOOP(top); \
@@ -340,6 +346,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #defineALLLINE_LOOP(top) do{   \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
for (l = 0; l  max_copper_layer + 2; l++, layer++) \
{ \
@@ -347,6 +354,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #define ALLARC_LOOP(top) do {  \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
for (l =0; l  max_copper_layer + 2; l++, layer++)  \
{ \
@@ -354,6 +362,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #defineALLPOLYGON_LOOP(top)do {\
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
for (l = 0; l  max_copper_layer + 2; l++, layer++) \
{ \
@@ -361,6 +370,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #defineCOPPERLINE_LOOP(top) do {   \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
for (l = 0; l  max_copper_layer; l++, layer++) \
{ \
@@ -368,6 +378,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #define COPPERARC_LOOP(top) do {   \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
for (l =0; l  max_copper_layer; l++, layer++)  \
{ \
@@ -375,6 +386,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #defineCOPPERPOLYGON_LOOP(top) do  {   \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
for (l = 0; l  max_copper_layer; l++, layer++) \
{ \
@@ -382,6 +394,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #defineSILKLINE_LOOP(top) do   {   \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
layer += max_copper_layer;  \
for (l = 0; l  2; l++, layer++)\
@@ -390,6 +403,7 @@ extern int mem_any_set (unsigned char *, int);
 
 #define SILKARC_LOOP(top) do   {   \
Cardinall;  \
+   GList *__copy = NULL; /* DUMMY */   \
LayerTypePtrlayer = (top)-Layer;   \
layer += max_copper_layer;  \
for (l = 0; l  2; l++, layer++)\
@@ -398,6 +412,7 @@ extern int 

Re: gEDA-user: gEDA with Guile 2.0

2011-06-05 Thread Dan McMahill
On 6/3/2011 6:04 PM, Peter TB Brett wrote:
 Hi folks,
 
 I've just checked in some changes that enable gEDA to compile and run
 with Guile 2.0.  Please report any issues.  Currently, the only known
 problem is that the `drc2' gnetlist backend is broken.

Thanks for doing this!

-Dan


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


Re: gEDA-user: Blog post: Porting gEDA to Guile 2.0, and future plans

2011-06-05 Thread Dan McMahill
On 6/5/2011 7:55 AM, Peter TB Brett wrote:
 Hi all,
 
 I just published a blog post in which I discuss porting to Guile 2,
 and ask for suggestions about what part of gEDA I should hack on
 next.  It includes a description of the various work-in-progress
 branches that I've currently got on the back burner, which might be
 of interest.
 

has anyone tried to compile against gtk3?



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