for later repro
ghostty weird memory thing
123 lines 6.7 kB view raw
1⏺ Bash(sudo footprint 680 2>/dev/null || footprint -p 680 2>/dev/null || echo "footprint not available, trying vmmap" && vmmap -summary 680 2>/dev/null | head -30) 2 ⎿  ====================================================================== 3 ghostty [680]: 64-bit Footprint: 20 GB (16384 bytes per page) 4 ====================================================================== 5 6 Dirty Clean Reclaimable Regions Category 7 --- --- --- --- --- 8 20 GB 0 B 0 B 34277 untagged (VM_ALLOCATE) 9 247 MB 0 B 0 B 23 IOSurface 10 169 MB 0 B 2288 KB 174 IOAccelerator (graphics) 11 51 MB 0 B 0 B 1 page table 12 16 MB 0 B 320 KB 11 MALLOC_MEDIUM 13 14 MB 0 B 16 KB 15 MALLOC_SMALL 14 11 MB 0 B 0 B 1 MALLOC_NANO 15 8256 KB 0 B 0 B 3 IOAccelerator 16 7856 KB 0 B 0 B 208 Owned physical footprint (unmapped) 17 7504 KB 0 B 16 KB 34 MALLOC_TINY 18 4296 KB 16 KB 0 B 934 __DATA 19 2736 KB 0 B 0 B 93 CoreAnimation 20 1392 KB 0 B 0 B 45 stack 21 1344 KB 0 B 0 B 16 CG image 22 1216 KB 0 B 0 B 9 CoreUI image data 23 1194 KB 0 B 0 B 710 __AUTH 24 1088 KB 0 B 0 B 6 CoreImage 25 821 KB 0 B 0 B 341 __DATA_DIRTY 26 592 KB 0 B 0 B 49 MALLOC metadata 27 592 KB 0 B 0 B 31 ColorSync 28 537 KB 0 B 0 B 2068 unused dyld shared cache area 29 128 KB 0 B 0 B 1 Accelerate image backing stores 30 112 KB 144 KB 0 B 965 __DATA_CONST 31 112 KB 0 B 0 B 8 IOKit 32 96 KB 0 B 0 B 954 __AUTH_CONST 33 64 KB 0 B 0 B 2 __TPRO_CONST 34 48 KB 0 B 0 B 3 CoreGraphics 35 32 KB 0 B 0 B 1 Activity Tracing 36 32 KB 0 B 0 B 3 MALLOC_LARGE 37 16 KB 0 B 0 B 1 os_alloc_once 38 16 KB 0 B 0 B 2 Foundation 39 0 B 0 B 22 MB 1 MALLOC_LARGE_REUSABLE 40 0 B 0 B 16 KB 2 ImageIO 41 0 B 9456 KB 0 B 76 mapped file 42 0 B 4704 KB 0 B 987 __TEXT 43 0 B 16 KB 0 B 6 __LINKEDIT 44 0 B 0 B 0 B 1 __FONT_DATA 45 0 B 0 B 0 B 1 __INFO_FILTER 46 0 B 0 B 0 B 1 __CTF 47 --- --- --- --- --- 48 20 GB 14 MB 25 MB 42066 TOTAL 49 50 Auxiliary data: 51 phys_footprint: 20 GB 52 phys_footprint_peak: 20 GB 53 54 Process: ghostty [680] 55 Path: /Applications/Ghostty.app/Contents/MacOS/ghostty 56 Load Address: 0x100714000 57 Identifier: ghostty 58 Version: ??? 59 Code Type: ARM64 60 Platform: macOS 61 Parent Process: launchd [1] 62 Target Type: corpse 63 64 Date/Time: 2026-01-01 21:06:18.650 -0600 65 Launch Time: 2026-01-01 20:28:30.669 -0600 66 OS Version: macOS 15.7.3 (24G419) 67 Report Version: 7 68 Analysis Tool: /usr/bin/vmmap 69 70 Physical footprint: 20.2G 71 Physical footprint (peak): 20.3G 72 Idle exit: untracked 73 ---- 74 75 ReadOnly portion of Libraries: Total=1.7G resident=329.6M(19%) swapped_out_or_unallocated=1.3G(81%) 76 Writable regions: Total=22.1G written=58.2M(0%) resident=114.4M(1%) swapped_out=19.7G(89%) unallocated=2.3G(10%) 77 78 VIRTUAL RESIDENT DIRTY SWAPPED VOLATILE NONVOL EMPTY REGION 79 REGION TYPE SIZE SIZE SIZE SIZE SIZE SIZE SIZE COUNT (non-coalesced) 80 =========== ======= ======== ===== ======= ======== ====== ===== ======= 81 Accelerate framework 128K 128K 0K 128K 0K 128K 0K 1 82 Activity Tracing 256K 32K 32K 0K 0K 32K 0K 1 83 AttributeGraph Data 1024K 336K 336K 16K 0K 0K 0K 1 84 85∴ Thinking… 86 87 Found it! Look at this line: 88 89 20 GB 0 B 0 B 34277 untagged (VM_ALLOCATE) 90 91 And then at the bottom: 92 Writable regions: Total=22.1G written=58.2M(0%) resident=114.4M(1%) swapped_out=19.7G(89%) unallocated=2.3G(10%) 93 94 So 19.7 GB is swapped out - it's not actually in RAM. There's some memory that Ghostty allocated (via VM_ALLOCATE) that's mostly swapped to disk. This is likely a memory leak or large 95 buffer allocation in Ghostty that's not actually being used (hence swapped out). 96 97 This could be: 98 1. A memory leak in Ghostty itself (34,277 regions of untagged VM_ALLOCATE = 20GB) 99 2. Terminal scrollback buffers that have grown very large 100 3. Some GPU-related memory allocation 101 102 The key insight is: this isn't actually consuming 20GB of physical RAM - it's 89% swapped out. But it IS a potential problem in Ghostty. 103 104 The user has been running 3 Claude sessions with lots of output, which could create massive scrollback buffers. Let me check if there's a scrollback setting or if this is a known Ghostty 105 issue. 106 107⏺ Found it! Look at this: 108 109 20 GB 0 B 0 B 34277 untagged (VM_ALLOCATE) 110 111 And: 112 Writable regions: swapped_out=19.7G(89%) 113 114 20 GB of untagged (VM_ALLOCATE) memory - and 89% of it is swapped to disk, not actually in RAM. This is likely scrollback buffer accumulation in Ghostty from your 3 Claude sessions running for ~35 minutes with lots of output. 115 116 This is a Ghostty issue, not Claude. Options: 117 118 1. Restart Ghostty - quickest fix 119 2. Reduce scrollback - in your Ghostty config, add: 120 scrollback-limit = 10000 121 3. Clear scrollback in each tab: Cmd+K or clear && printf '\e[3J' 122 123 The good news: it's not actually using 20GB of physical RAM (it's 89% swapped), but Ghostty is leaking/accumulating memory in scrollback that should probably be limited.