warp.print_memory_report#

warp.print_memory_report(file=None, sort='size', max_items=10)[source]#

Print a report of all currently tracked memory allocations.

Requires warp.config.track_memory to be True (set before warp.init()), or an active ScopedMemoryTracker.

Note

Not safe to call concurrently from multiple threads.

Parameters:
  • file – File object to write to (defaults to sys.stdout).

  • sort – Sort order for live allocations: "size" (default, largest first) or "chronological" (oldest first).

  • max_items – Maximum number of individual allocations shown per category (default 10).

Raises:
  • ValueError – If sort is not "size" or "chronological".

  • RuntimeError – If allocation tracking is not active.