each call to open_file_guts leaks the old GLCanon object, o.g.
the canon object keeps references to information like the endpoints
of each line in the program, which can add up to a lot of memory.

it would be ideal to not leak the GLCanon object, but in the meantime
calling its new .clear() method can reduce the memory from megabytes
per reload to kilobytes per reload, which greatly reduces the impact
of the bug.
---
If you're able to test this patch, please let us know whether it worked
for you.  It would be nice to reduce this memory leak to a tolerable
level for the last 2.3.5 release.

 lib/python/rs274/glcanon.py           |    6 ++++++
 src/emc/usr_intf/axis/scripts/axis.py |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lib/python/rs274/glcanon.py b/lib/python/rs274/glcanon.py
index 39af454..f571ccc 100644
--- a/lib/python/rs274/glcanon.py
+++ b/lib/python/rs274/glcanon.py
@@ -46,6 +46,12 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
         self.dwell_time = 0
         self.suppress = 0
 
+    def clear(self):
+        self.traverse[:] = []
+        self.feed[:] = []
+        self.arcfeed[:] = []
+        self.dwells[:] = []
+
     def message(self, message): pass
 
     def next_line(self, st):
diff --git a/src/emc/usr_intf/axis/scripts/axis.py 
b/src/emc/usr_intf/axis/scripts/axis.py
index faa721a..6df52ef 100644
--- a/src/emc/usr_intf/axis/scripts/axis.py
+++ b/src/emc/usr_intf/axis/scripts/axis.py
@@ -1938,6 +1938,8 @@ def open_file_guts(f, filtered=False, addrecent=True):
     set_first_line(0)
     t0 = time.time()
 
+    if o.g is not None:
+        o.g.clear()
     canon = None
     try:
         # be sure to switch modes to cause an interp synch, which
-- 
1.6.6.62.g584f3


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to