[Bf-python] Memory bug in Bpy api

Bobby Parker sh0rtwave at gmail.com
Sun Jan 22 18:25:36 CET 2006


There often seems to be no rhyme or reason to when it crashes. Sometimes it
dies immediately on startup, sometimes runs a little while, so forth, so on.

I "demodularized" it (i.e., button variables are no longer stored in the
module, and ShaderEditorGUI is loadable standalone), and it runs
significantly longer before it crashes. As a means of testing, I added in a
counter to see how many button objects are created and destroyed on
successive calls to Redraw(), and I saw crashes at all number of values from
~200 buttons and above.

By no means think that I'm creating 200 buttons on the screen at once :)
That would be a bit extreme!

Bobby

On 1/22/06, Ken Hughes <khughes at pacific.edu> wrote:
>
> OK, I've cut the code in ShaderEditorGUI.py down to 35 lines, completely
> eliminating all modules except Blender.Draw, and I can still get the
> crashs when exiting the script.  It is very "twitchy" though; adding or
> removing some seemingly unrelated code can make the bug disappear.
>
> Ken
>
> Bobby Parker wrote:
> > The majority of them aren't defined anywhere, it's just placeholder at
> > the moment. The only ones that currently work are shader_draw,
> > shader_event, and shader_bevent in the file ShaderEditorGUI.py
> >
> > The script callbacks that are being loaded, are imported from
> > btor.ShaderEditorGUI.
> >
> > Bobby
> >
> > On 1/22/06, *Ken Hughes* <khughes at pacific.edu
> > <mailto:khughes at pacific.edu>> wrote:
> >
> >     Bobby Parker wrote:
> >      > Hi,
> >      > I'm developing a script using the Python API, and I think I've
> >     found a
> >      > nice memory bug.
> >
> >     Ok, I was finally able to get cgkit and aqsis installed, but wasn't
> able
> >     to follow your instructions for setting up BtoR.py.  I did put it in
> its
> >     own directory, modified BtoR.py to append that dir to sys.path so
> >     subsequent imports would find the other modules, and ran the
> script.  I
> >     got somewhat different results probably because of this.
> >
> >     1) with no reload removed, I get an error on the first script
> execution
> >     inside the first call to master_gui(), when shader_draw() is
> called.  It
> >     dies in PyObject_Malloc.
> >     2) if I remove all the reloads except reload( btor.ShaderEditorGui),
> I
> >     can run the script, kill with ESC, about 4 times, then get an error
> in
> >     PyObject_GC_UnTrack() called from PyDict_Clear() in
> BPY_clear_script().
> >       This is where the script global dict is cleared.
> >     3) if I remove all the reloads, everything works
> >     4) if I just put a "return" in master_gui(), thing work OK for the
> >     scripts in 1) and 2).
> >
> >     So it is related to the script callbacks executing and the reloads.
> >
> >     BTW, where the heck are the functions in master_gui() defined?
> >
> >     Ken
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20060122/9fb27f75/attachment.html>


More information about the Bf-python mailing list