Hi all,
I have serious memory usage growth in Blender python. I am trying to use a standard python profiler. However I am unable to get any profiler to work with Blender python.
Here is the test script that works with python 2.4.3 outside Blender:
#--------
import profile
def func1(N):
for i in range(N):
j=ii
k=3i+j/4.0
profile.run(‘func1(1000000)’)
#--------
& returns:
5 function calls in 1.140 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.050 0.050 0.050 0.050 :0(range)
1 0.000 0.000 0.000 0.000 :0(setprofile)
1 0.000 0.000 1.140 1.140 <string>:1(?)
1 1.090 1.090 1.140 1.140 TestProfiler.py:3(func1)
1 0.000 0.000 1.140 1.140 profile:0(func1(1000000))
0 0.000 0.000 profile:0(profiler)
If I run the same script in the Blender 2.46 ‘Interactive Python Console’, I get the following error:
File “TestProfiler.py”, line 9, in ?
profile.run(‘func1(1000000)’)
File “/usr/lib/python2.4/profile.py”, line 72, in run
prof = prof.run(statement)
File “/usr/lib/python2.4/profile.py”, line 448, in run
return self.runctx(cmd, dict, dict)
File “/usr/lib/python2.4/profile.py”, line 452, in runctx
sys.setprofile(self.dispatcher)
File “/usr/lib/python2.4/site-packages/psyco/profiler.py”, line 356, in psyco_setprofile
return result
File “/usr/lib/python2.4/profile.py”, line 238, in trace_dispatch_i
if self.dispatch[event](self, frame, t):
File “/usr/lib/python2.4/profile.py”, line 322, in trace_dispatch_return
assert frame is self.cur[-2].f_back, (“Bad return”, self.cur[-3])
AssertionError: (‘Bad return’, (‘profile’, 0, ‘func1(1000000)’))
Does anyone have any experience with using profilers in Blender python? Is there a solution or work around?
Thanks.
albcem