Re: [PyOpenGL-Users] glInterleavedArrays memory leak
Brought to you by:
mcfletch
From: Micah D. <mi...@na...> - 2003-08-02 20:36:29
|
On Sat, Aug 02, 2003 at 01:01:20PM +1000, Rene Dudfield wrote: > Micah Dowty wrote: ... > >In 'top' this should show the python process' memory usage steadily > >rising. This is from a Gentoo Linux system on an Athlon XP. > >I have tested it with PyOpenGL 2.0.0.42 and 2.0.1.04, both show the bug. ... > Very nice on the bzFlag front! > > The memory leak is there. It leaks with numeric arrays as well. > > #-------------------------------------------------------------------------------------------- > import pygame, time > from pygame.locals import * > from OpenGL.GL import * > import Numeric > try: > from numeric_gl import * > except: > print "numeric_gl import failed" > > pygame.init() > pygame.display.set_mode((640,480), OPENGL|DOUBLEBUF) > while 1: > b = [ 0.0, 0.0, 0.0, > 1.0, 0.0, 0.0, > 1.0, 1.0, 0.0, > 0.0, 1.0, 0.0 ] * (10000 / 12) > > glInterleavedArrays( GL_V3F, 0, b) > > time.sleep(0.01) > pygame.display.flip() > #-------------------------------------------------------------------------------------------- > > > It's related to the way that array related functions in pyopengl are > used. I've been thinking of redoing them for a while but haven't had > time :( > > I've made a seperate numeric module with the gl*Pointer functions. I > just added a glInterleavedArrays which doesn't seem to have a memory leak. > > Could you give it a go and tell me what you think? > > > It can be found here: > http://py3d.org/files/numeric_gl.tar.gz > > It only works with numeric arrays(ie strings etc will probably not work). > > It's only tested/compiled on debian linux. I ran the OpenglContext test > which used numeric arrays and it ran ok once I removed the tostring() calls. > I'm on Gentoo here with Python 2.2.3 and it compiled fine. Appears to solve the memory leak too :) > > I will eventually add this into pyopengl I think. That is a seperate > sub module for numeric stuff. Which would be automatically detected and > included into OpenGL.GL using python. I'm looking forward to it! > > Along with some PyArray_ContiguousFromObject type function calls to > allow you to check if memory is being copied unnecessarily(or did you > allready add something like this Mike?). > > > Have fun! > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users -- Only you can prevent creeping featurism! |