Skip to content

ipsw diff is taking too much memory #985

@PoomSmart

Description

@PoomSmart

What happened?

Most likely on a machine with low amount of RAM (16GB), running ipsw diff will always fail.

Command

ipsw diff iPhone_4.7_P3_15.7.1_19H117_Restore.ipsw iPhone_4.7_P3_16.0_20A362_Restore.ipsw --output iPhone8Diff --markdown --block-list "__TEXT.__info_plist" --verbose

Output

   • Diffing KERNELCACHES     
      • Extracted /var/folders/kq/s0mp6h6n4q7blm0jknh9zs500000gn/T/ipsw_extract_kcache3421100095/kernelcache.release.iphone10 from iPhone_4.7_P3_15.7.1_19H117_Restore.ipsw
      • Extracted /var/folders/kq/s0mp6h6n4q7blm0jknh9zs500000gn/T/ipsw_extract_kcache3421100095/kernelcache.release.iphone9 from iPhone_4.7_P3_15.7.1_19H117_Restore.ipsw
      • Parsing Kernelcache IMG4 
      • Decompressing Kernelcache
      • Detected LZFSE compression
      • Parsing Kernelcache IMG4 
      • Decompressing Kernelcache
      • Detected LZFSE compression
         • Extracting arch 'AARCH64, ARM64' from single slice fat MachO file
      • Extracted /var/folders/kq/s0mp6h6n4q7blm0jknh9zs500000gn/T/ipsw_extract_kcache2186698516/kernelcache.release.iphone10 from iPhone_4.7_P3_16.0_20A362_Restore.ipsw
      • Parsing Kernelcache IMG4 
      • Decompressing Kernelcache
      • Detected LZFSE compression
         • Extracting arch 'AARCH64, ARM64' from single slice fat MachO file
   ⨯ failed to parse kernelcaches error=failed to find kernelcache for d101ap in 'New' IPSW: `ipsw diff` expects you to compare 2 versions of the same IPSW device type
   • Diffing DYLD_SHARED_CACHES
   • Mounting 'Old' SystemOS DMG
      • failed to get SystemOS DMG; trying filesystem DMG
      • Found extracted 098-03539-020.dmg
      • Mounting 098-03539-020.dmg
         • 098-03539-020.dmg already mounted
   • Mounting 'New' SystemOS DMG
      • Found extracted 098-09210-001.dmg
      • Mounting 098-09210-001.dmg
         • 098-09210-001.dmg already mounted
   • Parsing Cache             cache=/private/tmp/098-03539-020.dmg.mount/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64
   • Parsing Cache             cache=/private/tmp/098-09210-001.dmg.mount/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64
zsh: killed     ipsw diff iPhone_4.7_P3_15.7.1_19H117_Restore.ipsw  --output iPhone8Diff

ipsw memory usage behavior

  1. It would use around 13-14 GB initially
  2. Then it would spike to around 48 GB and eventually crash ipsw

How can we reproduce this?

  1. Prepare the system with only 16 GB RAM
  2. Download iPhone 8 iOS 15.7.1 and iOS 16.0 IPSW
  3. Diff them with ipsw diff iPhone_4.7_P3_15.7.1_19H117_Restore.ipsw iPhone_4.7_P3_16.0_20A362_Restore.ipsw --output iPhone8Diff --markdown --block-list "__TEXT.__info_plist" --verbose

ipsw version

Version: 3.1.644, BuildCommit: 761eca800e75886ae5e817a7d03d28c531bbd288

Search

  • I did search for other open and closed issues before opening this

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions