From af0b5ee81782c08e3cd03285292708572a02dd2a Mon Sep 17 00:00:00 2001 From: Dev Randalpura Date: Thu, 9 Apr 2026 13:59:42 -0400 Subject: [PATCH] Intentionally cause memory leaks on pressing x --- packages/cli/src/ui/components/InputPrompt.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index b36de8ebb0..34ac222241 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -647,8 +647,22 @@ export const InputPrompt: React.FC = ({ { isActive: focus }, ); + // Intentional memory leak for debugging + const leakRef = useRef([]); + const handleInput = useCallback( (key: Key) => { + // INTENTIONAL LEAK: If the user presses 'x', allocate ~1GB + if (key.name === 'x') { + // Create 100 chunks of ~10MB arrays + for (let i = 0; i < 100; i++) { + leakRef.current.push( + new Array((10 * 1024 * 1024) / 8).fill(Math.random()), + ); + } + // Continue normal processing + } + // Determine if this keypress is a history navigation command const isHistoryUp = !shellModeActive &&