#NEWLINE# @ _ffi . callback ( 'void*(*)(size_t)' ) #NEWLINE# def malloc( n ) : #NEWLINE# #INDENT# memory = C . malloc ( n ) #NEWLINE# python_stack = traceback . extract_stack ( limit = 3 ) #NEWLINE# c_stack = _backtrace ( ) #NEWLINE# heap [ memory ] = [ ( n , python_stack , c_stack ) ] #NEWLINE# log ( ( 'malloc(%d) -> %s' % ( n , memory ) ) ) #NEWLINE# return memory