[Emc-developers] [PATCH for v2.3.x] paper over a memory leak

2010-02-12 Thread Jeff Epler
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
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


[Emc-developers] [PATCH for v2.3.x] fix a memory leak

2010-02-12 Thread Jeff Epler
By binding a method of AxisCanon, the instance becomes
uncollectable.  This reformulation still has a small leak
(one Tkinter command binding) but it is not the several
megabytes that leaking an AxisCanon could cause.
---
I should have waited a few minutes longer before firing off the first
patch.  I feel like I understand the memory leak better this time, and
prefer this patch to the first one.

 src/emc/usr_intf/axis/scripts/axis.py |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/emc/usr_intf/axis/scripts/axis.py 
b/src/emc/usr_intf/axis/scripts/axis.py
index faa721a..bf26aeb 100644
--- a/src/emc/usr_intf/axis/scripts/axis.py
+++ b/src/emc/usr_intf/axis/scripts/axis.py
@@ -1744,7 +1744,6 @@ class AxisCanon(GLCanon):
 self.linecount = linecount
 self.progress = progress
 self.aborted = False
-root_window.bind_class(.info.progress, Escape, self.do_cancel)
 
 def comment(self, arg):
 if arg.startswith(AXIS,):
@@ -1914,6 +1913,10 @@ def add_recent_file(f):
 ap.putpref('recentfiles', recent, repr)
 update_recent_menu()
 
+def cancel_open(event=None):
+if o.g is not None:
+o.g.aborted = True
+
 loaded_file = None
 def open_file_guts(f, filtered=False, addrecent=True):
 if addrecent:
@@ -1968,6 +1971,7 @@ def open_file_guts(f, filtered=False, addrecent=True):
 progress.nextphase(len(lines))
 f = os.path.abspath(f)
 o.g = canon = AxisCanon(o, widgets.text, i, progress)
+root_window.bind_class(.info.progress, Escape, cancel_open)
 
 parameter = inifile.find(RS274NGC, PARAMETER_FILE)
 temp_parameter = os.path.join(tempdir, os.path.basename(parameter))
-- 
1.6.6.62.g584f3

On Fri, Feb 12, 2010 at 10:44:26AM -0600, Jeff Epler wrote:
 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
 Emc-developers@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-developers
 

--
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
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


[Emc-developers] git workflow question

2010-02-12 Thread Chris Morley


 At this point we may want to investigate some of the workflows suggested
 in the gitworkflows[1] document.  Specifically, here's how we can use
 topic branches, integration branches and merging upwards to put safe new
 features in 2.4.x after they're proven on master:
 

pncconf in 2.4 will need some features disabled.
In master I wish to continue to develop them, obviously.
 
How do I handle this with out messing up future merges 
from trunk to 2.4 ? 

Thanks 

Chris M
  
_
Check your Hotmail from your phone.
http://go.microsoft.com/?linkid=9708121--
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
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers


Re: [Emc-developers] git workflow question

2010-02-12 Thread Alexey Starikovskiy
You may find stgit useful.

Regards,
Alex.

Chris Morley пишет:

  At this point we may want to investigate some of the workflows suggested
  in the gitworkflows[1] document. Specifically, here's how we can use
  topic branches, integration branches and merging upwards to put safe new
  features in 2.4.x after they're proven on master:
 

 pncconf in 2.4 will need some features disabled.
 In master I wish to continue to develop them, obviously.
  
 How do I handle this with out messing up future merges
 from trunk to 2.4 ?

 Thanks

 Chris M

 
 Live connected with Hotmail on your phone. Learn more.
 http://go.microsoft.com/?linkid=9708117
 

 --
 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
 Emc-developers@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-developers
   


--
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
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers