parameters: (dtor)
return_statement: return mem_finalize
docstring: finalises memory
      Parameters:
      dtor a function that will delete/free held memory from a reference
  
      Returns:
      Finalising function
docstring_summary: finalises memory
      Parameters:
      dtor a function that will delete/free held memory from a reference
docstring_tokens: finalises memory Parameters : dtor a function that will delete / free held memory from a reference
function: def _make_mem_finalizer(dtor):
      """
      finalises memory
      Parameters:
      dtor a function that will delete/free held memory from a reference
  
      Returns:
      Finalising function
      """
      def mem_finalize(context, handle):
          allocations = context.allocations
          sync = hsa.implicit_sync
  
          def core():
              _logger.info("Current allocations: %s", allocations)
              if allocations:
                  _logger.info("Attempting delete on %s" % handle.value)
                  del allocations[handle.value]
              sync()  # implicit sync
              dtor(handle)
          return core
  
      return mem_finalize
function_tokens: def _make_mem_finalizer ( dtor ) : def mem_finalize ( context , handle ) : allocations = context . allocations sync = hsa . implicit_sync def core ( ) : _logger . info ( "Current allocations: %s" , allocations ) if allocations : _logger . info ( "Attempting delete on %s" % handle . value ) del allocations [ handle . value ] sync ( ) # implicit sync dtor ( handle ) return core return mem_finalize