From: <jam...@fd...> - 2007-01-03 13:51:15
|
Hi. Please, is there any body working on a native C method to clean the gdots object ? I am currently doing: for dot funct3.dots: dot.visible=False funct3.dots=[] but this is very time consuming for many dots. Is there a native C way or a built in way of doing this ? thanks. ============================================ Jose Antonio Martin H. Departamento de Sistemas Informáticos y Computación Facultad de Informática Universidad Complutense de Madrid Ciudad universitaria, 28040 Madrid ============================================ |
From: Bruce S. <Bru...@nc...> - 2007-01-03 17:17:01
|
In Visual 3 which you're using, it was necessary to implement gdots=20 using a list of label statements, which was very slow, and the only way=20 to get rid of the dots is to do what you did. In the beta Visual 4 (see vpython.org > Recent developments), gdots is=20 implemented as a single "points" object, and you can get rid of all the=20 dots by saying simply "mygdots.dots.pos =3D []" (assuming your gdots name= =20 was "mygdots"). Bruce Sherwood Jos=E9 Antonio Mart=EDn H wrote: > Hi. > > Please, is there any body working on a native C method to clean the gdo= ts=20 > object ? > > I am currently doing: > > for dot funct3.dots: > dot.visible=3DFalse > > funct3.dots=3D[] > > > but this is very time consuming for many dots. > > Is there a native C way or a built in way of doing this ? > > thanks. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Jose Antonio Martin H. > Departamento de Sistemas Inform=E1ticos y Computaci=F3n > Facultad de Inform=E1tica > Universidad Complutense de Madrid > Ciudad universitaria, 28040 Madrid > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > -----------------------------------------------------------------------= -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share= your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > =20 |
From: <jam...@fd...> - 2007-01-03 23:37:07
|
Hi, by the way what happends with this code ? that is, is the memory freed after each initialization ? self.Gtrajectory = gcurve(gdisplay=self.clwindow,color=color.yellow) do some plot operation on self.Gtrajectory self.Gtrajectory.gcurve.visible = False del self.Gtrajectory self.Gtrajectory = gcurve(gdisplay=self.clwindow,color=color.yellow) This code cleans the graphic object gcurve but i am not sure that the memory is freed It this code cleaning the memory too ? Is there any other way of cleaning a gcurve object ? Kind regards. jose ============================================ Jose Antonio Martin H. Departamento de Sistemas Informáticos y Computación Facultad de Informática Universidad Complutense de Madrid Ciudad universitaria, 28040 Madrid ============================================ |
From: Bruce S. <Bru...@nc...> - 2007-01-03 23:43:27
|
That should free up memory eventually, when Python does garbage=20 collection. Python keeps a reference count on all objects (and Visual=20 adds another one if the object is visible, because the human user=20 constitutes another reference to the object, which is why you have to=20 make the object invisible before deleting it). When the reference count=20 goes to zero, Python can delete the data from memory., At least that's=20 the way it's SUPPOSED to work. Bruce Jos=E9 Antonio Mart=EDn H wrote: > Hi, by the way what happends with this code ? > that is, is the memory freed after each initialization ? > > self.Gtrajectory =3D gcurve(gdisplay=3Dself.clwindow,color=3Dcolor.yell= ow) > > do some plot operation on self.Gtrajectory > > > self.Gtrajectory.gcurve.visible =3D False > del self.Gtrajectory > self.Gtrajectory =3D gcurve(gdisplay=3Dself.clwindow,color=3Dcolor.yell= ow) > > > This code cleans the graphic object gcurve but i am not sure that the=20 > memory is freed > > It this code cleaning the memory too ? > > Is there any other way of cleaning a gcurve object ? > > Kind regards. > jose > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Jose Antonio Martin H. > Departamento de Sistemas Inform=E1ticos y Computaci=F3n > Facultad de Inform=E1tica > Universidad Complutense de Madrid > Ciudad universitaria, 28040 Madrid > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > |