react-native-update 10.53.1 → 10.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README-CN.md +59 -31
  2. package/README.md +62 -32
  3. package/android/jni/HDiffPatch/.travis.yml +33 -0
  4. package/android/jni/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  5. package/android/jni/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  6. package/android/jni/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  7. package/android/jni/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  8. package/android/jni/HDiffPatch/builds/xcode/lz4.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  9. package/android/jni/HDiffPatch/builds/xcode/lzma.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  10. package/android/jni/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  11. package/android/jni/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  12. package/android/jni/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  13. package/android/jni/HDiffPatch/builds/xcode/zstd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  14. package/android/jni/lzma/DOC/7zC.txt +187 -0
  15. package/android/jni/lzma/DOC/7zFormat.txt +469 -0
  16. package/android/jni/lzma/DOC/Methods.txt +173 -0
  17. package/android/jni/lzma/DOC/installer.txt +166 -0
  18. package/android/jni/lzma/DOC/lzma-history.txt +446 -0
  19. package/android/jni/lzma/DOC/lzma-sdk.txt +357 -0
  20. package/android/jni/lzma/DOC/lzma-specification.txt +1176 -0
  21. package/android/jni/lzma/DOC/lzma.txt +328 -0
  22. package/android/jni/lzma/bin/7zS2.sfx +0 -0
  23. package/android/jni/lzma/bin/7zS2con.sfx +0 -0
  24. package/android/jni/lzma/bin/7zSD.sfx +0 -0
  25. package/android/jni/lzma/bin/7zdec.exe +0 -0
  26. package/android/jni/lzma/bin/7zr.exe +0 -0
  27. package/android/jni/lzma/bin/installer/config.txt +5 -0
  28. package/android/jni/lzma/bin/installer/cr.bat +5 -0
  29. package/android/jni/lzma/bin/lzma.exe +0 -0
  30. package/android/jni/lzma/bin/x64/7zr.exe +0 -0
  31. package/android/lib/arm64-v8a/librnupdate.so +0 -0
  32. package/android/lib/armeabi-v7a/librnupdate.so +0 -0
  33. package/android/lib/x86/librnupdate.so +0 -0
  34. package/android/lib/x86_64/librnupdate.so +0 -0
  35. package/android/src/main/java/cn/reactnative/modules/update/ArchiveLimits.java +44 -0
  36. package/android/src/main/java/cn/reactnative/modules/update/DownloadTask.java +124 -40
  37. package/android/src/main/java/cn/reactnative/modules/update/InstallRecord.java +125 -0
  38. package/android/src/main/java/cn/reactnative/modules/update/NativeCheckOrchestrator.java +43 -11
  39. package/android/src/main/java/cn/reactnative/modules/update/NativeUpdateFlow.java +2 -0
  40. package/android/src/main/java/cn/reactnative/modules/update/SafeZipFile.java +90 -0
  41. package/android/src/main/java/cn/reactnative/modules/update/UpdateContext.java +79 -19
  42. package/android/src/main/java/cn/reactnative/modules/update/UpdateFileUtils.java +21 -0
  43. package/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java +33 -2
  44. package/android/src/main/java/cn/reactnative/modules/update/UpdateModuleSupport.java +1 -0
  45. package/android/src/newarch/cn/reactnative/modules/update/UpdateModule.java +5 -0
  46. package/android/src/oldarch/cn/reactnative/modules/update/UpdateModule.java +5 -0
  47. package/cpp/patch_core/archive_limits.h +38 -0
  48. package/cpp/patch_core/install_record.h +36 -0
  49. package/cpp/update_flow_core/flow_json.h +1 -0
  50. package/cpp/update_flow_core/update_flow_core.cpp +41 -7
  51. package/cpp/update_flow_core/update_flow_core.h +9 -0
  52. package/cpp/update_flow_core/update_flow_jni.cpp +12 -0
  53. package/harmony/pushy/src/main/cpp/PushyTurboModule.cpp +2 -0
  54. package/harmony/pushy/src/main/cpp/pushy.cpp +37 -0
  55. package/harmony/pushy/src/main/ets/ArchiveLimits.ts +83 -0
  56. package/harmony/pushy/src/main/ets/DownloadTask.ts +126 -30
  57. package/harmony/pushy/src/main/ets/InstallRecord.ts +129 -0
  58. package/harmony/pushy/src/main/ets/NativeCheckOrchestrator.ts +24 -2
  59. package/harmony/pushy/src/main/ets/NativePatchCore.ts +5 -0
  60. package/harmony/pushy/src/main/ets/PushyTurboModule.ts +12 -0
  61. package/harmony/pushy/src/main/ets/UpdateContext.ts +78 -15
  62. package/harmony/pushy.har +0 -0
  63. package/ios/RCTPushy/RCTPushy.mm +384 -25
  64. package/ios/RCTPushy/RCTPushyDownloader.mm +32 -0
  65. package/package.json +25 -2
  66. package/src/NativePushy.ts +13 -0
  67. package/src/client.ts +288 -47
  68. package/src/core.ts +17 -3
  69. package/src/error.ts +3 -0
  70. package/src/errorReporting.ts +136 -0
  71. package/src/index.ts +14 -0
  72. package/src/locales/en.ts +3 -0
  73. package/src/locales/zh.ts +2 -0
  74. package/src/metadata.ts +166 -0
  75. package/src/provider.tsx +52 -17
  76. package/src/type.ts +29 -0
  77. package/src/updateFlowCore.ts +95 -4
  78. package/src/utils.ts +31 -19
  79. package/.gitmodules +0 -6
  80. package/BUNDLEHASH_MIGRATION.md +0 -355
  81. package/NATIVE_CHECKUPDATE_DESIGN.md +0 -539
  82. package/NATIVE_CHECK_FOLLOWUPS.md +0 -514
  83. package/android/jni/HDiffPatch/test/_private_searchBestParams.cpp +0 -301
  84. package/android/jni/HDiffPatch/test/hpatchz_test.cpp +0 -292
  85. package/android/jni/HDiffPatch/test/testHashClash.cpp +0 -436
  86. package/android/jni/HDiffPatch/test/unit_test.cpp +0 -417
  87. package/biome.json +0 -59
  88. package/cpp/patch_core/tests/fixtures/rawstored.lzma2label.patch.bin +0 -0
  89. package/cpp/patch_core/tests/fixtures/rawstored.new.bin +0 -0
  90. package/cpp/patch_core/tests/fixtures/rawstored.old.bin +0 -0
  91. package/cpp/patch_core/tests/fixtures/v96.hbc +0 -0
  92. package/cpp/patch_core/tests/fixtures/v96.meta.json +0 -1
  93. package/cpp/patch_core/tests/fixtures/v96.streampatch.bin +0 -0
  94. package/cpp/patch_core/tests/fixtures/v96.t.hbc +0 -0
  95. package/cpp/patch_core/tests/fixtures/v96.tpatch.bin +0 -0
  96. package/cpp/patch_core/tests/fixtures/v96.tstreampatch.bin +0 -0
  97. package/cpp/patch_core/tests/fixtures/v96b.hbc +0 -0
  98. package/cpp/patch_core/tests/fixtures/v98.hbc +0 -0
  99. package/cpp/patch_core/tests/fixtures/v98.t.hbc +0 -0
  100. package/cpp/patch_core/tests/fixtures/v98b.hbc +0 -0
  101. package/cpp/patch_core/tests/fixtures/v98b.t.hbc +0 -0
  102. package/cpp/patch_core/tests/hbc_transform_test.cpp +0 -384
  103. package/cpp/patch_core/tests/patch_core_test.cpp +0 -970
  104. package/cpp/update_flow_core/tests/flow_vectors.json +0 -1401
  105. package/cpp/update_flow_core/tests/update_flow_core_test.cpp +0 -317
  106. package/scripts/check-expo-version.js +0 -92
package/README-CN.md CHANGED
@@ -16,10 +16,38 @@
16
16
 
17
17
  请查看[文档](https://pushy.reactnative.cn/docs/getting-started.html)
18
18
 
19
+ ### JS 错误上报
20
+
21
+ SDK 可以把未捕获错误和手动捕获的 JavaScript 错误关联到当前实际运行的热更版本。
22
+ 此能力默认开启、仅做尽力上报,在开发环境或启用 `disableTelemetry` 时不发送;
23
+ 全局处理器采用链式安装,不会取代 React Native、Sentry 或 Crashlytics 已有的处理器。
24
+
25
+ ```ts
26
+ import { Pushy } from 'react-native-update';
27
+
28
+ const client = new Pushy({ appKey: 'your-app-key' });
29
+
30
+ try {
31
+ await submitOrder();
32
+ } catch (error) {
33
+ client.captureException(error, {
34
+ extra: { screen: 'checkout', retry: 1 },
35
+ });
36
+ }
37
+
38
+ // 运行时显式退出(同时关闭手动 captureException 的传输):
39
+ client.setOptions({ disableErrorReporting: true });
40
+ ```
41
+
42
+ 也可以在初始化时通过 `new Pushy({ appKey, disableErrorReporting: true })` 直接退出。
43
+
44
+ 只有携带明确版本 hash 的热更版本错误会被上传。上下文字段只接受经过限长的标量值;
45
+ 不要放入密钥或个人信息。
46
+
19
47
  ### 优势
20
48
 
21
49
  1. 对中国用户使用阿里云高速 CDN 分发,对比其他服务器在国外的热更新服务,分发更稳定,更新成功率极高。海外用户智能分流至 cloudflare,同样提供稳定高速的分发体验。
22
- 2. 基于 bsdiff/hdiff 算法创建的**超小更新包**,通常版本迭代后在几十至几百 KB 级别(其他全量热更新服务所需流量通常在几十 MB 级别)。更针对 **Hermes 字节码专门优化了 diff 算法**(详见下方[算法对比](#diff-算法对比)),补丁体积进一步显著缩小。
50
+ 2. 基于 bsdiff/hdiff 算法创建的**超小更新包**,通常版本迭代后在几十至几百 KB 级别(其他全量热更新服务所需流量通常在几十 MB 级别)。整条链路更是**针对 Hermes 字节码做了专门优化**——单行改动只需下发 **3.4 KB**(详见下方[算法对比](#diff-算法对比));最新的优化都发生在构建期,**已上架的应用只需重新构建一次发版即可受益**。
23
51
  3. 始终跟进 RN 最新正式版本,第一时间提供支持。支持 hermes 字节码格式。支持新架构(注:安卓 0.73.0 ~ 0.76.0 的新架构因官方 bug 不支持,0.73 以下或 0.76.1 以上的新架构可用)。
24
52
  4. 跨越多个版本进行更新时,只需要下载**一个更新包**,不需要逐版本依次更新。
25
53
  5. 命令行工具 & 网页双端管理,版本发布过程简单便捷,完全可以集成 CI。
@@ -30,49 +58,49 @@
30
58
  10. **原生冷启动自愈**:即使热更版本坏到 JS 完全跑不起来(白屏、启动即崩),设备也能在下次启动时由原生侧自动拉到修复版——不需要用户重装,也不需要你发新的应用商店版本(详见下方[原生冷启动检测](#原生冷启动检测))。
31
59
  11. 提供付费的专人技术支持。
32
60
 
33
- ### 原生冷启动检测
34
-
35
- 自 10.52.1 起,每次冷启动后数秒会在后台线程执行一次**不依赖 app bundle** 的更新检查(下载、打补丁与状态切换全部在原生侧完成)。它的存在只为一件事:**当前热更版本坏到 JS 起不来时,仍有一条能把修复版拉下来的通路**——常规更新流程仍由应用内的 JS 负责,检查结果会被 JS 侧复用,不会重复请求。
36
-
37
- 几个需要知道的点:
61
+ ### Diff 算法对比
38
62
 
39
- - **不阻塞启动**:延迟数秒、跑在后台线程,成果在**下次启动**生效。
40
- - **是否自动激活取决于你的配置**:`updateStrategy` 为 `silentAndNow` / `silentAndLater` 且未关闭自动检查(`checkStrategy` 不为 `null`)时,原生侧才会把下载好的版本设为下次启动生效;其余情况只下载,激活权仍在 JS。
41
- - **救砖指令**:控制台可按版本标记「强制启动」,被标记的版本无视上述策略直接在下次启动生效——这是把已被坏版本卡死的设备捞回来的手段。设备本地的崩溃回滚保护仍然优先,已回滚过的版本不会被再装回去。
42
- - **崩溃时刻救援**(Android 与 iOS):应用在启动阶段死于未捕获的 JS 错误时,SDK 会短暂扣住垂死的进程(数秒、有硬上限),把检查与下载做完——即使版本每次启动零点几秒就崩,也能被换掉。该窗口内下载到的修复版一律设为下次启动生效(JS 已经没有机会做决策了)。崩溃上报不受影响:SDK 以链式方式保存并在结束后调用原有的崩溃处理器。不覆盖:原生(非 JS)崩溃、ANR、OOM 击杀,以及 iOS 上安装了自定义 `RCTSetFatalHandler` 的应用(那时 React Native 不再抛出本机制拦截的异常)。
43
- - **断点续传**:更新下载在进程死亡后保留进度、下次以 HTTP Range 续传,反复的短命启动也能单调累积进度;紧随中断轮次的下一次启动会跳过延迟立即续传。鸿蒙不需要崩溃时刻扣留:RNOH 下未捕获的 JS 错误不会杀死进程,JS 启动即崩时原生检测照常完成。
44
- - **可以关闭**:`disableNativeCheck: true`。关闭后每次冷启动少一次后台请求,代价是**放弃上述自愈能力**——被坏热更卡死的设备将无法自动恢复。仅在这次请求本身构成问题时(流量/耗电预算、隐私清单申报、需用户同意后才可联网)才建议关闭。
63
+ Hermes 字节码对通用二进制 diff 极不友好,我们在两个环节同时下手,且收益叠加:
45
64
 
46
- ### Diff 算法对比
65
+ - **delta 模式编译**。Hermes **每次**编译都会重排字符串表,JS 改一行就会让大部分字符串 ID 重新编号,两份几乎相同的字节码于是处处不同。`bundle` 会以同一应用更早的一份字节码为基准编译(`hermesc -base-bytecode=…`),把这些 ID 钉死在原位,只有真正的改动才会进入 diff。
66
+ - **HBC 感知的可逆变换**。Hermes 字节码中还有大量"偏移量表",中间插入几个字节就会令其后所有偏移整体位移。我们在 hdiff 之前引入一层 **delta-friendly 可逆变换**,对偏移位域做前项差分,把整体位移退化为单点变化。布局描述表随补丁下发,Hermes 版本演进时**客户端零升级**。
47
67
 
48
- 传统 diff 算法直接对字节做差分,而 Hermes 字节码中大量结构是"偏移量表"——JS 一处小改动会令其后所有偏移量整体位移,导致二进制差异被急剧放大。我们在 hdiff 之前引入了一层**针对 HBC(Hermes 字节码)的 delta-friendly 可逆变换**:对偏移位域做前项差分,从根源上消除这种位移放大。布局描述表由发布端随补丁下发,Hermes 版本演进时**客户端零升级**、自动兼容。
68
+ 此外字节码在产出时就不含 debug info 段(实测小 **21%**,与 React Native 自身 release 构建一致),全量包和由它派生的每一个补丁都随之变小。
49
69
 
50
- 以下数据在真实 RN 0.86 应用的 release 产物上实测(Hermes HBC v98,字节码约 4.4 MB),每个补丁都先通过完整往返校验再记录体积。完整的评测方法、测试数据与可复现代码见 **[hbc-diff-benchmark](https://github.com/sunnylqm/hbc-diff-benchmark)**。
70
+ 以下数据在真实 RN 0.86 应用的 release 产物上实测(Hermes HBC v98,字节码约 4.4 MB)。每个补丁都先通过完整往返校验再记录体积,每个 delta 模式产物都通过与普通编译的等价性校验。完整的评测方法、测试数据与可复现代码见 **[hbc-diff-benchmark](https://github.com/sunnylqm/hbc-diff-benchmark)**。
51
71
 
52
72
  **Hermes 字节码(.hbc)——生产环境 Hermes 应用的实际发包格式:**
53
73
 
54
- | 迭代场景 | 全量 OTA(gzip) | bsdiff | bsdiff+lzma | hdiff | hdiff + HBC 变换 |
55
- |---|---|---|---|---|---|
56
- | 单行文案修改 | 1901.5 KB | 93.7 KB | 87.7 KB | 89.0 KB | **63.5 KB**(−28% / −29%) |
57
- | 小功能(约 60 行) | 1913.9 KB | 411.6 KB | 330.9 KB | 328.0 KB | **285.5 KB**(−14% / −13%) |
58
- | 中等功能(约 300 行) | 1973.7 KB | 551.6 KB | 430.6 KB | 431.6 KB | **398.4 KB**(−7% / −8%) |
74
+ | 迭代场景 | 全量 OTA(gzip) | bsdiff | **react-native-update** | 对比 bsdiff |
75
+ |---|---|---|---|---|
76
+ | 单行文案修改 | 1901.5 KB | 93.7 KB | **3.4 KB** | **小 28 倍** |
77
+ | 小功能(约 60 行) | 1913.9 KB | 411.6 KB | **50.2 KB** | **小 8.2 倍** |
78
+ | 中等功能(约 300 行) | 1973.7 KB | 551.6 KB | **97.8 KB** | **小 5.6 倍** |
59
79
 
60
80
  **文本 JS bundle——非 Hermes 应用(同一应用、同样三个场景):**
61
81
 
62
- | 迭代场景 | 全量 OTA(gzip) | bsdiff | bsdiff+lzma | hdiff |
63
- |---|---|---|---|---|
64
- | 单行文案修改 | 807.2 KB | 0.3 KB | 0.7 KB | **0.1 KB** |
65
- | 小功能(约 60 行) | 813.1 KB | 7.4 KB | 7.4 KB | **5.8 KB** |
66
- | 中等功能(约 300 行) | 837.7 KB | 38.4 KB | 37.4 KB | **28.7 KB** |
82
+ | 迭代场景 | 全量 OTA(gzip) | bsdiff | **react-native-update** |
83
+ |---|---|---|---|
84
+ | 单行文案修改 | 807.2 KB | 0.3 KB | **0.1 KB** |
85
+ | 小功能(约 60 行) | 813.1 KB | 7.4 KB | **5.8 KB** |
86
+ | 中等功能(约 300 行) | 837.7 KB | 38.4 KB | **28.7 KB** |
67
87
 
68
- 文本 bundle 没有偏移量表,diff 天然干净——补丁只有几百字节到几十 KB,较大改动下 hdiff 仍比 bsdiff 小约 20%~25%。偏移位移放大是 Hermes 字节码特有的问题,这正是 HBC 变换存在的意义。
88
+ 文本 bundle 既没有偏移量表也没有字符串表重排,diff 天然干净——补丁只有几百字节到几十 KB。上述两项优化所消除的放大效应是 Hermes 字节码特有的问题,这正是它们存在的意义。
69
89
 
70
90
  要点:
71
91
 
72
- - 增量更新比全量 OTA 节省 **5~30 倍**流量(单行改动 63.5 KB vs 全量 1.9 MB)。
73
- - bsdiff+lzma 对照组(同一份 bsdiff 差分数据、换用 lzma 压缩)表明压缩器占了 bsdiff 与 hdiff 差距的大头——而 HBC 针对性变换再带来的 **7%~29%** 缩减是**纯算法收益**,且越是高频的小改动收益越大。
74
- - hdiff 生成补丁比 bsdiff 快 **2~4 倍**,变换本身开销仅个位数毫秒。
75
- - 安全兜底:改写任何字节前先对段边界、位域范围做全量校验,不匹配时自动回退到普通 hdiff 路径。
92
+ - 单行修复——也是最常见的热更类型——只需下发 **3.4 KB**,比全量 OTA 少 559 倍。
93
+ - 生成补丁比 bsdiff 快 **2~4 倍**,变换本身开销仅个位数毫秒。
94
+ - 每一环都有安全兜底:改写任何字节前先做全量校验,delta 模式产物要与普通编译结果比对,任一环节不匹配都自动回退到原有行为。
95
+
96
+ ### 原生冷启动检测
97
+
98
+ 自 10.52.1 起,每次冷启动后数秒会在后台线程执行一次**不依赖 app bundle** 的更新检查(下载、打补丁与状态切换全部在原生侧完成)。它的存在只为一件事:**当前热更版本坏到 JS 起不来时,仍有一条能把修复版拉下来的通路**——常规更新流程仍由应用内的 JS 负责,检查结果会被 JS 侧复用,不会重复请求。
99
+
100
+ - **不阻塞启动**:延迟数秒、跑在后台线程,成果在**下次启动**生效。下载到的版本是否自动激活取决于你的 `updateStrategy` / `checkStrategy`;否则只下载,激活权仍在 JS。
101
+ - **崩溃时刻救援**(Android 与 iOS):应用在启动阶段死于未捕获的 JS 错误时,SDK 会短暂扣住垂死的进程把检查与下载做完——即使版本每次启动零点几秒就崩,也能被换掉。崩溃上报不受影响:SDK 以链式方式保存并在结束后调用原有的崩溃处理器。不覆盖:原生崩溃、ANR、OOM 击杀,以及 iOS 上安装了自定义 `RCTSetFatalHandler` 的应用。
102
+ - **救砖指令**:控制台可按版本标记「强制启动」,被标记的版本无视上述策略直接在下次启动生效——这是把已被坏版本卡死的设备捞回来的手段。设备本地的崩溃回滚保护仍然优先,已回滚过的版本不会被再装回去。
103
+ - **可以关闭**:`disableNativeCheck: true`。关闭后每次冷启动少一次后台请求,代价是**放弃上述自愈能力**——被坏热更卡死的设备将无法自动恢复。
76
104
 
77
105
  ### 与其他热更新库对比
78
106
 
@@ -92,7 +120,7 @@
92
120
  | **灰度发布** | ✅ 后台自带,按比例逐步放量 | ✅ 支持 | ❌ **已停运** |
93
121
  | **数据统计** | ✅ 后台自带(版本分布、更新成功率等) | ⚠️ 有限 | ❌ **已停运** |
94
122
  | **健康度监控** | ✅ 后台自带版本健康度监控 | ❌ 不支持 | ❌ **已停运** |
95
- | **Hermes 专项 diff 优化** | ✅ HBC 结构感知,补丁更小 | ❌ 全量更新 | ❌ **已停运** |
123
+ | **Hermes 专项 diff 优化** | ✅ delta 模式编译 + HBC 结构感知变换,补丁更小 | ❌ 全量更新 | ❌ **已停运** |
96
124
  | **管理界面** | ✅ 命令行工具 + Web 管理界面 | ✅ Expo Dashboard | ❌ **已停运** |
97
125
  | **CI/CD 集成** | ✅ 支持 | ✅ 支持 | ❌ **已停运** |
98
126
  | **API 扩展性** | ✅ Meta 信息 + 开放 API | ⚠️ 有限 | ❌ **已停运** |
package/README.md CHANGED
@@ -14,10 +14,41 @@ See the docs:
14
14
 
15
15
  - English docs: <https://cresc.dev/docs/getting-started>
16
16
 
17
+ ## JS error reporting
18
+
19
+ The SDK reports uncaught and manually captured JavaScript errors against the
20
+ currently running OTA release. Reporting is enabled by default, best-effort,
21
+ disabled in development and when `disableTelemetry` is enabled, and never
22
+ replaces an existing React Native, Sentry or Crashlytics global handler.
23
+
24
+ ```ts
25
+ import { Cresc } from 'react-native-update';
26
+
27
+ const client = new Cresc({ appKey: 'your-app-key' });
28
+
29
+ try {
30
+ await submitOrder();
31
+ } catch (error) {
32
+ client.captureException(error, {
33
+ extra: { screen: 'checkout', retry: 1 },
34
+ });
35
+ }
36
+
37
+ // Explicit runtime opt-out (also disables manual captureException transport):
38
+ client.setOptions({ disableErrorReporting: true });
39
+ ```
40
+
41
+ You can also opt out at construction with
42
+ `new Cresc({ appKey, disableErrorReporting: true })`.
43
+
44
+ Only errors from an OTA version with a known version hash are uploaded. Context
45
+ is deliberately restricted to bounded scalar values; do not include secrets or
46
+ personal information.
47
+
17
48
  ## Advantages
18
49
 
19
50
  1. react-native-update provides a dedicated global service with fast and reliable worldwide delivery.
20
- 2. **Tiny update packages** generated with bsdiff/hdiff are typically only tens to hundreds of KB, instead of the tens of MB usually required by full-bundle update systems. On top of that, the diff algorithm is **specifically optimized for Hermes bytecode** (see the [comparison below](#diff-algorithm-comparison)), shrinking patches even further.
51
+ 2. **Tiny update packages** generated with bsdiff/hdiff are typically only tens to hundreds of KB, instead of the tens of MB usually required by full-bundle update systems. The whole pipeline is **specifically optimized for Hermes bytecode** — a one-line change ships in **3.4 KB** (see the [comparison below](#diff-algorithm-comparison)), and because the newest optimizations happen at build time, **apps already in the store benefit from nothing more than a rebuild**.
21
52
  3. The library tracks new React Native stable releases closely, supports Hermes bytecode, and supports the new architecture. Note: Android RN 0.73.0 to 0.76.0 new architecture is unavailable because of upstream issues; versions below 0.73 or above 0.76.1 are supported.
22
53
  4. When updating across multiple versions, clients only need to download **one update package** instead of applying every intermediate version in sequence.
23
54
  5. Command-line tools and a web dashboard are both available, making release workflows simple and CI-friendly.
@@ -28,49 +59,49 @@ See the docs:
28
59
  10. **Native cold-start recovery**: even when an update is broken badly enough that JS never runs (white screen, crash on launch), the device pulls the fixed version on its next launch from the native side — no reinstall, no app-store release (see [Native cold-start check](#native-cold-start-check)).
29
60
  11. Paid technical support is available.
30
61
 
31
- ## Native cold-start check
32
-
33
- Since 10.52.1 every cold start runs one background update check a few seconds after launch that **does not depend on the app bundle** — the request, the download, the patch and the version switch all happen natively. It exists for exactly one reason: **when the running update is broken enough that JS never starts, something still has to be able to fetch the fix.** Normal updates remain the JS flow's job; the JS check reuses this result instead of issuing its own request.
34
-
35
- What to know:
62
+ ## Diff Algorithm Comparison
36
63
 
37
- - **It never blocks startup**: it is delayed by a few seconds, runs off the main thread, and its result takes effect on the *next* launch.
38
- - **Whether it activates depends on your configuration**: only with `updateStrategy` set to `silentAndNow` / `silentAndLater` *and* automatic checks left on (`checkStrategy` not `null`) will the native side mark a downloaded version for the next launch. Otherwise it downloads and leaves activation to JS.
39
- - **Rescue directive**: the dashboard can mark a version "force boot", which activates on the next launch regardless of the strategies above — this is how a fleet stuck on a broken version is recovered. The device-local crash-rollback guard still wins: a version this device already rolled back from is never reinstalled.
40
- - **Crash-moment rescue** (Android & iOS): when the app dies of an uncaught JS error during startup, the SDK briefly holds the dying process (a few seconds, bounded) to finish the check and download — so even a version that crashes a fraction of a second into every launch gets replaced. In that window the downloaded fix is always activated for the next launch, since JS is no longer around to decide. Crash reporters keep working: the SDK chains the previous crash handler and always hands the crash over afterwards. Not covered: native (non-JS) crashes, ANRs, OOM kills, and — on iOS — apps that install a custom `RCTSetFatalHandler` (React Native then no longer raises the exception this rescue intercepts).
41
- - **Resumable downloads**: update downloads survive process death and resume from where they stopped (HTTP Range), so repeated short-lived launches still make monotonic progress; a launch that follows an interrupted round skips the startup delay and resumes immediately. HarmonyOS does not need the crash-moment hold: an uncaught JS error does not kill the process there, so the native check completes normally even when JS dies on launch.
42
- - **It can be turned off**: `disableNativeCheck: true` removes one background request per cold start, at the cost of **giving up the recovery above** — a device bricked by a bad update can no longer heal itself. Choose it only when that request is itself the problem (traffic/battery budgets, privacy manifests, consent-gated networking).
64
+ Hermes bytecode is hostile to generic binary diffing, and we attack that at two points that stack:
43
65
 
44
- ## Diff Algorithm Comparison
66
+ - **Delta-mode compilation.** Hermes re-sorts its string table on **every** compile, so a one-line JS edit renumbers most string IDs and two nearly identical bytecode files end up differing almost everywhere. `bundle` compiles against an earlier bytecode of the same app (`hermesc -base-bytecode=…`), pinning those IDs so that only real changes ever reach the diff.
67
+ - **An HBC-aware transform.** Hermes bytecode is also full of offset tables, where inserting a few bytes shifts every subsequent offset. Before running hdiff we apply a **delta-friendly reversible transform** that delta-encodes those offset bitfields, so a global shift collapses into a single-point change. The layout description ships with each patch, so **clients need zero upgrades** as Hermes evolves.
45
68
 
46
- Traditional diff algorithms operate on raw bytes. Hermes bytecode, however, is full of offset tables — a small JS change shifts every subsequent offset, which dramatically amplifies the binary difference. Before running hdiff, we apply a **delta-friendly reversible transform tailored to HBC (Hermes bytecode)**: offset bitfields are delta-encoded so the offset-shift amplification disappears at the source. The layout description table is shipped with each patch, so when Hermes evolves, **clients need zero upgrades** — compatibility is automatic.
69
+ The bytecode is also emitted without its debug-info section — a flat **21%** smaller, the same thing React Native's own release builds do — which shrinks the full package and every patch derived from it.
47
70
 
48
- The numbers below are measured on real release bundles of a React Native 0.86 app (Hermes HBC v98, ~4.4 MB bytecode); every patch is verified by an actual round-trip before its size is recorded. Full methodology, fixtures, and runnable code: **[hbc-diff-benchmark](https://github.com/sunnylqm/hbc-diff-benchmark)**.
71
+ The numbers below are measured on real release bundles of a React Native 0.86 app (Hermes HBC v98, ~4.4 MB bytecode). Every patch is verified by an actual round-trip before its size is recorded, and every delta-mode build is verified equivalent to a plain compile. Full methodology, fixtures, and runnable code: **[hbc-diff-benchmark](https://github.com/sunnylqm/hbc-diff-benchmark)**.
49
72
 
50
73
  **Hermes bytecode (.hbc) — what ships in production Hermes apps:**
51
74
 
52
- | Scenario | Full OTA (gzip) | bsdiff | bsdiff+lzma | hdiff | hdiff + HBC transform |
53
- |---|---|---|---|---|---|
54
- | One-line text change | 1901.5 KB | 93.7 KB | 87.7 KB | 89.0 KB | **63.5 KB** (−28% / −29%) |
55
- | Small feature (~60 LOC) | 1913.9 KB | 411.6 KB | 330.9 KB | 328.0 KB | **285.5 KB** (−14% / −13%) |
56
- | Medium feature (~300 LOC) | 1973.7 KB | 551.6 KB | 430.6 KB | 431.6 KB | **398.4 KB** (−7% / −8%) |
75
+ | Scenario | Full OTA (gzip) | bsdiff | **react-native-update** | vs bsdiff |
76
+ |---|---|---|---|---|
77
+ | One-line text change | 1901.5 KB | 93.7 KB | **3.4 KB** | **28× smaller** |
78
+ | Small feature (~60 LOC) | 1913.9 KB | 411.6 KB | **50.2 KB** | **8.2× smaller** |
79
+ | Medium feature (~300 LOC) | 1973.7 KB | 551.6 KB | **97.8 KB** | **5.6× smaller** |
57
80
 
58
81
  **Plain-text JS bundle — non-Hermes apps (same scenarios, same app):**
59
82
 
60
- | Scenario | Full OTA (gzip) | bsdiff | bsdiff+lzma | hdiff |
61
- |---|---|---|---|---|
62
- | One-line text change | 807.2 KB | 0.3 KB | 0.7 KB | **0.1 KB** |
63
- | Small feature (~60 LOC) | 813.1 KB | 7.4 KB | 7.4 KB | **5.8 KB** |
64
- | Medium feature (~300 LOC) | 837.7 KB | 38.4 KB | 37.4 KB | **28.7 KB** |
83
+ | Scenario | Full OTA (gzip) | bsdiff | **react-native-update** |
84
+ |---|---|---|---|
85
+ | One-line text change | 807.2 KB | 0.3 KB | **0.1 KB** |
86
+ | Small feature (~60 LOC) | 813.1 KB | 7.4 KB | **5.8 KB** |
87
+ | Medium feature (~300 LOC) | 837.7 KB | 38.4 KB | **28.7 KB** |
65
88
 
66
- Text bundles have no offset tables, so they diff cleanly without any transform — patches are hundreds of bytes to tens of KB, and hdiff still beats bsdiff by ~20–25% on the larger changes. The offset-shift amplification is a Hermes-bytecode-specific problem, which is exactly why the HBC transform exists.
89
+ Text bundles have no offset tables and no string-table churn, so they diff cleanly on their own — patches are hundreds of bytes to tens of KB. The amplification the two optimizations above remove is a Hermes-bytecode-specific problem, which is exactly why they exist.
67
90
 
68
91
  Highlights:
69
92
 
70
- - Incremental updates save **5–30×** bandwidth compared to full-bundle OTA (63.5 KB vs 1.9 MB for a one-line change).
71
- - The bsdiff+lzma control group (same bsdiff delta, lzma compression) shows the compressor accounts for most of the bsdiff-vs-hdiff gap — the further **7–29%** cut from the HBC-aware transform is **pure algorithmic gain**, largest on the small, frequent updates that dominate real OTA traffic.
72
- - Patch generation with hdiff is **2–4× faster** than bsdiff; the transform itself costs single-digit milliseconds.
73
- - Safety first: section bounds and bitfield ranges are fully validated before any byte is touched, and the pipeline automatically falls back to plain hdiff on any mismatch.
93
+ - A one-line fix — by far the most common hot update — ships in **3.4 KB**, 559× less than a full-bundle OTA.
94
+ - Patch generation is **2–4× faster** than bsdiff; the transform itself costs single-digit milliseconds.
95
+ - Every stage fails safe: bounds are validated before any byte is touched, delta-mode output is checked against a plain compile, and any mismatch falls back to the previous behaviour.
96
+
97
+ ## Native cold-start check
98
+
99
+ Since 10.52.1 every cold start runs one background update check that **does not depend on the app bundle** — the request, the download, the patch and the version switch all happen natively. It exists for exactly one reason: **when the running update is broken enough that JS never starts, something still has to be able to fetch the fix.** Normal updates remain the JS flow's job, and the JS check reuses this result instead of issuing its own request.
100
+
101
+ - **It never blocks startup**: delayed by a few seconds, off the main thread, effective on the *next* launch. Whether the downloaded version is activated automatically depends on your `updateStrategy` / `checkStrategy`; otherwise it is downloaded and JS decides.
102
+ - **Crash-moment rescue** (Android & iOS): if the app dies of an uncaught JS error during startup, the SDK briefly holds the dying process to finish the check and download — so even a version that crashes a fraction of a second into every launch gets replaced. Crash reporters keep working: the previous handler is chained and always called afterwards. Not covered: native crashes, ANRs, OOM kills, and iOS apps that install a custom `RCTSetFatalHandler`.
103
+ - **Rescue directive**: marking a version "force boot" in the dashboard activates it on the next launch regardless of the strategies above — this is how a fleet stuck on a broken version is recovered. The device-local crash-rollback guard still wins: a version this device already rolled back from is never reinstalled.
104
+ - **It can be turned off**: `disableNativeCheck: true` removes one background request per cold start, at the cost of **giving up the recovery above** — a device bricked by a bad update can no longer heal itself.
74
105
 
75
106
  ## Comparison With Other OTA Libraries
76
107
 
@@ -78,11 +109,10 @@ Highlights:
78
109
  |---------|---------------------|-------------|------------------------|
79
110
  | **Price / Cost** | Free tier with multiple paid plans, bandwidth included | Free tier with multiple paid plans, extra bandwidth charges apply | ❌ **Discontinued** (Microsoft App Center shut down on March 31, 2025) |
80
111
  | **Package Size** | ⭐⭐⭐⭐⭐ Tens to hundreds of KB (incremental) | ⭐⭐⭐ Full bundle updates (usually tens of MB) | ❌ **Discontinued** |
81
- | **Hermes-specific diff** | ✅ HBC-aware transform, smallest patches | ❌ Full bundle | ❌ **Discontinued** |
112
+ | **Hermes-specific diff** | ✅ Delta-mode compile + HBC-aware transform, smallest patches | ❌ Full bundle | ❌ **Discontinued** |
82
113
  | **Staged (gray) rollout** | ✅ Built-in, percentage-based | ✅ Supported | ❌ **Discontinued** |
83
114
  | **Analytics** | ✅ Built-in (version distribution, success rate) | ⚠️ Limited | ❌ **Discontinued** |
84
115
  | **Release health monitoring** | ✅ Built-in | ❌ Not available | ❌ **Discontinued** |
85
116
  | **Technical Support** | ✅ Paid dedicated support | ⚠️ Community support | ❌ **Discontinued** |
86
117
  | **Server Deployment** | ✅ Hosted service or paid private deployment | ✅ Hosted by Expo (EAS Update) | ❌ **Discontinued** |
87
118
  | **Bandwidth Usage** | ⭐⭐⭐⭐⭐ Very low (incremental) | ⭐⭐⭐ Higher (full bundle) | ❌ **Discontinued** |
88
-
@@ -0,0 +1,33 @@
1
+ language: cpp
2
+ matrix:
3
+ include:
4
+ - os: linux
5
+ compiler: clang
6
+ - os: linux
7
+ compiler: gcc
8
+ - os: linux
9
+ compiler: arm-linux-gnueabi-gcc
10
+ addons:
11
+ apt:
12
+ packages:
13
+ - qemu
14
+ - gcc-arm-linux-gnueabi
15
+ - libc-dev-armel-cross
16
+ env: CHOST=arm-linux-gnueabi
17
+ - os: osx
18
+ osx_image: xcode9.4
19
+ script:
20
+ - make LZMA=0
21
+ - make clean
22
+ - git clone https://github.com/sisong/lzma.git ../lzma
23
+ - make DIR_DIFF=0
24
+ - make clean
25
+ - make
26
+ - make clean
27
+ - cd ../HDiffPatch
28
+ - git clone https://github.com/sisong/libmd5.git ../libmd5
29
+ - make MT=1 MD5=1
30
+ - if [[ $TRAVIS_OS_NAME == osx ]]; then xcodebuild -workspace builds/xcode/HDiffPatch.xcworkspace -scheme hdiffz -configuration Release OBJROOT=$PWD/bin SYMROOT=$PWD/bin; fi
31
+ - if [[ $TRAVIS_OS_NAME == osx ]]; then xcodebuild -workspace builds/xcode/HDiffPatch.xcworkspace -scheme hpatchz -configuration Release OBJROOT=$PWD/bin SYMROOT=$PWD/bin; fi
32
+ - if [[ $TRAVIS_OS_NAME == osx ]]; then xcodebuild -workspace builds/xcode/HDiffPatch.xcworkspace -scheme unitTest -configuration Release OBJROOT=$PWD/bin SYMROOT=$PWD/bin; fi
33
+
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:bestParams.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:HDiffZ.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:HPatch.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:lz4.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:lzma.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:testHashConflict.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:unitTest.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:zstd.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,187 @@
1
+ 7z ANSI-C Decoder 9.35
2
+ ----------------------
3
+
4
+ 7z ANSI-C provides 7z/LZMA decoding.
5
+ 7z ANSI-C version is simplified version ported from C++ code.
6
+
7
+ LZMA is default and general compression method of 7z format
8
+ in 7-Zip compression program (www.7-zip.org). LZMA provides high
9
+ compression ratio and very fast decompression.
10
+
11
+
12
+ LICENSE
13
+ -------
14
+
15
+ 7z ANSI-C Decoder is part of the LZMA SDK.
16
+ LZMA SDK is written and placed in the public domain by Igor Pavlov.
17
+
18
+ Files
19
+ ---------------------
20
+
21
+ 7zDecode.* - Low level 7z decoding
22
+ 7zExtract.* - High level 7z decoding
23
+ 7zHeader.* - .7z format constants
24
+ 7zIn.* - .7z archive opening
25
+ 7zItem.* - .7z structures
26
+ 7zMain.c - Test application
27
+
28
+
29
+ How To Use
30
+ ----------
31
+
32
+ You can create .7z archive with 7z.exe, 7za.exe or 7zr.exe:
33
+
34
+ 7z.exe a archive.7z *.htm -r -mx -m0fb=255
35
+
36
+ If you have big number of files in archive, and you need fast extracting,
37
+ you can use partly-solid archives:
38
+
39
+ 7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K
40
+
41
+ In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only
42
+ 512KB for extracting one file from such archive.
43
+
44
+
45
+ Limitations of current version of 7z ANSI-C Decoder
46
+ ---------------------------------------------------
47
+
48
+ - It reads only "FileName", "Size", "LastWriteTime" and "CRC" information for each file in archive.
49
+ - It supports only LZMA and Copy (no compression) methods with BCJ or BCJ2 filters.
50
+ - It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.
51
+
52
+ These limitations will be fixed in future versions.
53
+
54
+
55
+ Using 7z ANSI-C Decoder Test application:
56
+ -----------------------------------------
57
+
58
+ Usage: 7zDec <command> <archive_name>
59
+
60
+ <Command>:
61
+ e: Extract files from archive
62
+ l: List contents of archive
63
+ t: Test integrity of archive
64
+
65
+ Example:
66
+
67
+ 7zDec l archive.7z
68
+
69
+ lists contents of archive.7z
70
+
71
+ 7zDec e archive.7z
72
+
73
+ extracts files from archive.7z to current folder.
74
+
75
+
76
+ How to use .7z Decoder
77
+ ----------------------
78
+
79
+ Memory allocation
80
+ ~~~~~~~~~~~~~~~~~
81
+
82
+ 7z Decoder uses two memory pools:
83
+ 1) Temporary pool
84
+ 2) Main pool
85
+ Such scheme can allow you to avoid fragmentation of allocated blocks.
86
+
87
+
88
+ Steps for using 7z decoder
89
+ --------------------------
90
+
91
+ Use code at 7zMain.c as example.
92
+
93
+ 1) Declare variables:
94
+ inStream /* implements ILookInStream interface */
95
+ CSzArEx db; /* 7z archive database structure */
96
+ ISzAlloc allocImp; /* memory functions for main pool */
97
+ ISzAlloc allocTempImp; /* memory functions for temporary pool */
98
+
99
+ 2) call CrcGenerateTable(); function to initialize CRC structures.
100
+
101
+ 3) call SzArEx_Init(&db); function to initialize db structures.
102
+
103
+ 4) call SzArEx_Open(&db, inStream, &allocMain, &allocTemp) to open archive
104
+
105
+ This function opens archive "inStream" and reads headers to "db".
106
+ All items in "db" will be allocated with "allocMain" functions.
107
+ SzArEx_Open function allocates and frees temporary structures by "allocTemp" functions.
108
+
109
+ 5) List items or Extract items
110
+
111
+ Listing code:
112
+ ~~~~~~~~~~~~~
113
+
114
+ Use SzArEx_GetFileNameUtf16 function. Look example code in C\Util\7z\7zMain.c file.
115
+
116
+
117
+ Extracting code:
118
+ ~~~~~~~~~~~~~~~~
119
+
120
+ SZ_RESULT SzAr_Extract(
121
+ CArchiveDatabaseEx *db,
122
+ ILookInStream *inStream,
123
+ UInt32 fileIndex, /* index of file */
124
+ UInt32 *blockIndex, /* index of solid block */
125
+ Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
126
+ size_t *outBufferSize, /* buffer size for output buffer */
127
+ size_t *offset, /* offset of stream for required file in *outBuffer */
128
+ size_t *outSizeProcessed, /* size of file in *outBuffer */
129
+ ISzAlloc *allocMain,
130
+ ISzAlloc *allocTemp);
131
+
132
+ If you need to decompress more than one file, you can send these values from previous call:
133
+ blockIndex,
134
+ outBuffer,
135
+ outBufferSize,
136
+ You can consider "outBuffer" as cache of solid block. If your archive is solid,
137
+ it will increase decompression speed.
138
+
139
+ After decompressing you must free "outBuffer":
140
+ allocImp.Free(outBuffer);
141
+
142
+ 6) call SzArEx_Free(&db, allocImp.Free) to free allocated items in "db".
143
+
144
+
145
+
146
+
147
+ Memory requirements for .7z decoding
148
+ ------------------------------------
149
+
150
+ Memory usage for Archive opening:
151
+ - Temporary pool:
152
+ - Memory for uncompressed .7z headers
153
+ - some other temporary blocks
154
+ - Main pool:
155
+ - Memory for database:
156
+ Estimated size of one file structures in solid archive:
157
+ - Size (4 or 8 Bytes)
158
+ - CRC32 (4 bytes)
159
+ - LastWriteTime (8 bytes)
160
+ - Some file information (4 bytes)
161
+ - File Name (variable length) + pointer + allocation structures
162
+
163
+ Memory usage for archive Decompressing:
164
+ - Temporary pool:
165
+ - Memory for LZMA decompressing structures
166
+ - Main pool:
167
+ - Memory for decompressed solid block
168
+ - Memory for temprorary buffers, if BCJ2 fileter is used. Usually these
169
+ temprorary buffers can be about 15% of solid block size.
170
+
171
+
172
+ 7z Decoder doesn't allocate memory for compressed blocks.
173
+ Instead of this, you must allocate buffer with desired
174
+ size before calling 7z Decoder. Use 7zMain.c as example.
175
+
176
+
177
+ Defines
178
+ -------
179
+
180
+ _SZ_ALLOC_DEBUG - define it if you want to debug alloc/free operations to stderr.
181
+
182
+
183
+ ---
184
+
185
+ http://www.7-zip.org
186
+ http://www.7-zip.org/sdk.html
187
+ http://www.7-zip.org/support.html