From 1a8fce8edb1c2ed62035356e1e00a5eec14a7682 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 12 Jul 2024 15:33:03 -0700 Subject: [PATCH] show stack trace of 10 files tking up memory --- litellm/proxy/common_utils/debug_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/common_utils/debug_utils.py b/litellm/proxy/common_utils/debug_utils.py index 8306ad0fb5..9d8d35e196 100644 --- a/litellm/proxy/common_utils/debug_utils.py +++ b/litellm/proxy/common_utils/debug_utils.py @@ -9,7 +9,7 @@ from litellm._logging import verbose_proxy_logger router = APIRouter() if os.environ.get("LITELLM_PROFILE", "false").lower() == "true": - tracemalloc.start() + tracemalloc.start(10) @router.get("/memory-usage", include_in_schema=False) async def memory_usage(): @@ -22,7 +22,7 @@ if os.environ.get("LITELLM_PROFILE", "false").lower() == "true": top_50 = top_stats[:50] result = [] for stat in top_50: - result.append(f"{stat.traceback.format()}: {stat.size / 1024} KiB") + result.append(f"{stat.traceback.format(limit=10)}: {stat.size / 1024} KiB") return {"top_50_memory_usage": result}