#NEWLINE# def execute( self , function , * args , **kwargs ) : #NEWLINE# #INDENT# def call_many_times( ) : #NEWLINE# #INDENT# for x in xrange ( ( LOOPS - 1 ) ) : #NEWLINE# #INDENT# self . call ( function , * args , ** kwargs ) #NEWLINE# #UNINDENT# del x #NEWLINE# gc . collect ( ) #NEWLINE# return self . get_mem ( ) #NEWLINE# #UNINDENT# self . call ( function , * args , ** kwargs ) #NEWLINE# self . assertEqual ( gc . garbage , [ ] ) #NEWLINE# self . assertEqual ( threading . active_count ( ) , 1 ) #NEWLINE# rss1 = call_many_times ( ) #NEWLINE# rss2 = call_many_times ( ) #NEWLINE# difference = ( rss2 - rss1 ) #NEWLINE# if ( difference > MEMORY_TOLERANCE ) : #NEWLINE# #INDENT# stop_at = ( time . time ( ) + 3 ) #NEWLINE# while True : #NEWLINE# #INDENT# self . call ( function , * args , ** kwargs ) #NEWLINE# if ( time . time ( ) >= stop_at ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# del stop_at #NEWLINE# gc . collect ( ) #NEWLINE# rss3 = self . get_mem ( ) #NEWLINE# difference = ( rss3 - kwargs ) #NEWLINE# if ( rss3 > rss2 ) : #NEWLINE# #INDENT# self . fail ( ( 'rss2=%s, rss3=%s, difference=%s' % ( rss2 , rss3 , difference ) ) )