[Twisted-Python] Decorator @inlinecallbacks prohibiting memory profiling

Vikas vikas.c.kumar at oracle.com
Wed Oct 21 07:37:39 MDT 2015


Hi,

I am trying to instrument method: run() for memory profiling(I am using 
memory_profiler & guppy tools for this). All I need to do is decorate 
the run() with "profile" decorator and mention *start* and *end* of 
memory profiling.

@profile
def run():
     d = {}
     l = []
     hp = hpy()
     before = hp.heap()            => *start* memory profiling from here

     d["k1"] = 'val1'
     d["k2"] = 10
     count = 0
     while (count < 9):
         l.append(count)
         print 'The count is:', count
         count = count + 1
     print "Good bye!"
     after = hp.heap()         => *end* memory profiling here
     leftover = after - before

     print leftover
     del hp


So far works fine. But moment I introduce @inlineCallbacks before 
@profile(see below), I don't see memory getting profiled. Am I doing 
something wrong here?
@inlinecallbacks
@profile
def run():
     ....

Regards
Vikas


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20151021/51d75f05/attachment.html>


More information about the Twisted-Python mailing list