[wx-dev] WxGrid memory leak in wxpython2.7.1 and 2.8 on a dual core processor system

Gayatri gayatrin at infotechsw.com
Mon Mar 3 03:06:46 PST 2008


Hi Robin,

I could create a sample which reproduces the problem. When I run the
application, after 5-10min. it crashes giving a message 'Access violation:
unhandled exception in wxmsw28d_adv_vc.dll' or 'Access violation: unhandled
exception in wxbase28d_vc.dll'.

This application crashes only on dual core systems.

My system configuration: windows XP - SP 2, Intel Pentium D processor-based
PC with IntelR dual-core processing technology
With Python -2.5.1 and wxPython-2.8.7.1

The sample application is attached.

Thanks for any help in solving this issue.

Regards,
Gayatri


> -----Original Message-----
> From: Gayatri [mailto:gayatrin at infotechsw.com] 
> Sent: Friday, February 15, 2008 4:24 PM
> To: 'wxPython-users at lists.wxwidgets.org'
> Subject: RE: [wxPython-users] Re: [wx-dev] Re: [wxPython-users] WxGrid
> memory leak in wxpython2.7.1 and 2.8 on a dual core processor system
> 
> Hello All,
> 
>  We used wxgrid of wxPython-2.8.7.1 in a GUI application we got memory
> access violation error while executing. Earlier we posted the below
message
> specifying the issue but we couldn't send the code as it cannot be
> independently executed to reproduce the error and also the error is not
> repeatable. 

I'm sorry, but there is no way we can diagnose a problem like this 
without a way to reproduce it.  From the description you give it is 
likely that the real source of the problem is several or many steps 
before the crashes you are seeing, or is due to something not being done 
correctly many times in a loop, and without a runnable sample there is 
no way to guess what those things are.  If you are unable to duplicate 
the problem in a small app that does similar things as your main app, 
then that should tell you that the real problem is in some part that you 
are not duplicating or simulating.

http://wiki.wxpython.org/MakingSampleApps


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-dev-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-dev-help at lists.wxwidgets.org
-------------- next part --------------
#!/usr/bin/env python
#Boa:App:BoaApp

import wx

import gridTestFrame

modules ={u'gridTestFrame': [1, 'Main frame of Application', u'gridTestFrame.py']}

class BoaApp(wx.App):
    def OnInit(self):
        self.main = gridTestFrame.create(None)
        self.main.Show()
        self.SetTopWindow(self.main)
        return True

def main():
    application = BoaApp(0)
    application.MainLoop()

if __name__ == '__main__':
    main()
-------------- next part --------------
#Boa:Frame:Frame1
import os
import wx
import wx.grid
from wx.grid import *
from wx.py import images
import threading
import time

def create(parent):
	return SimulationGUIFrame(parent)

[wxID_SIMULATIONGUIFRAME,
 wxID_SIMULATIONGUIFRAMETOPNOTEBOOK,
 wxID_SIMULATIONPANEL
 ] = map(lambda _init_ctrls: wx.NewId(), range(3))
 
class CDTimer(threading.Thread):
	def __init__(self):
		threading.Thread.__init__(self)
		self.isToRun = True
		self.grid = None
		self.cnt = 0

	def run(self):
		while(self.isToRun):
			if self.grid != None:
				if (self.cnt%2):
					self.grid.BeginBatch()
					self.grid.SetCellValue(1,1,'40')
					self.grid.SetCellValue(2,3,'50')             
					self.grid.SetCellValue(3,3,'0.232323')
					self.grid.SetCellValue(4,1,'80')
					self.grid.SetCellValue(4,2,'0.23')
					self.grid.SetCellValue(4,3,'0.2323')
					self.grid.SetCellValue(5,1,'0.23232323')
					self.grid.EndBatch()
					
				else:
					self.grid.BeginBatch()
					self.grid.SetCellValue(1,1,'0.232323')
					self.grid.SetCellValue(2,3,'0.232323')               
					self.grid.SetCellValue(3,3,'170')
					self.grid.SetCellValue(4,1,'0.23232')
					self.grid.SetCellValue(5,2,'0.23239')
					self.grid.SetCellValue(5,3,'0.23239')
					self.grid.SetCellValue(5,1,'0.23237')
					self.grid.SetCellValue(6,2,'0.23235')
					self.grid.EndBatch()
				#self.panel.Simulationgrid.SetCellFont(6,1, self.panel.Simulationgrid.GetDefaultCellFont())
					
				self.cnt = self.cnt + 1             
				time.sleep(.01)

class SimulationGUIFrame(wx.Frame):
	def _init_ctrls(self, prnt):
		# generated method, don't edit
		wx.Frame.__init__(self, id=wxID_SIMULATIONGUIFRAME,
			  name=u'SimulationGUIFrame', parent=prnt, pos=wx.Point(-4, -4),
			  size=wx.Size(425, 500),
			  style=wx.DEFAULT_FRAME_STYLE,
			  title=u'Simulation Parameters Monitor')
		wx.EVT_CLOSE(self, self.OnSimulationGUIFrameClose)

	def __init__(self, parent):
		self._init_ctrls(parent)
		self.clientSize = self.GetClientSize()
		self.origin = self.GetClientAreaOrigin() 
		self.topNotebook = wx.Notebook(self, wxID_SIMULATIONGUIFRAMETOPNOTEBOOK, style=0)
		self.simulationPanel = SimulationPanel(self.topNotebook, self.clientSize, CDTimer())
		self.topNotebook.AddPage(self.simulationPanel, 'Tab1')
		self.simulationPanel.cdTimer.start()
				
	def OnSimulationGUIFrameClose(self, event):
		self.simulationPanel.cdTimer.isToRun = False    
		event.Skip()
		
class SimulationPanel(wx.Panel):
	def _init_ctrls(self, prnt):
		# generated method, don't edit
		wx.Panel.__init__(self, id=wxID_SIMULATIONPANEL,name=u'SimulationPanel',
								parent=prnt, style=wx.TAB_TRAVERSAL)        
		
	def __init__(self, parent,size, cdTimer):
		self.SimulationGridPos = parent.GetClientAreaOrigin()
		self.SimulationGridSize = size
		self._init_ctrls(parent)
		self.cdTimer = cdTimer
		self.CreateSimulaitonGrid()
		self.cdTimer.grid = self.Simulationgrid

	def CreateSimulaitonGrid(self):
		"""
		Creation of grid  with respect to client size
		"""
		self.Simulationgrid = Grid(self,3,self.SimulationGridPos,self.SimulationGridSize,
									 wx.WANTS_CHARS|wx.RAISED_BORDER ,'') 
		self.Simulationgrid.CreateGrid(20,4)
		


More information about the wx-dev mailing list