expo-tiddlywiki-filesystem-android-external-storage 2.6.0 → 2.7.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.
@@ -84,17 +84,48 @@ internal object GitHelper {
84
84
  }
85
85
 
86
86
  /**
87
- * Ensure repository git config forces protocol.version=0.
87
+ * Ensure repository git config forces protocol.version=0 and
88
+ * constrains pack memory for Android's limited heap.
89
+ *
88
90
  * TidGi Desktop's git server uses `git --stateless-rpc` which only speaks V0/V1.
89
91
  * JGit defaults to V2 negotiation, which causes the error:
90
92
  * "Starting read stage without written request data pending is not supported"
91
93
  * because the server doesn't handle V2 capability advertisements.
94
+ *
95
+ * Pack memory limits prevent OOM on large repos (Android heap is ~268MB).
96
+ * Default JGit settings: deltaCacheSize=50MB, windowMemory=unlimited,
97
+ * bigFileThreshold=50MB — far too much for a mobile device.
92
98
  */
93
99
  private fun ensureProtocolV0(repo: Repository) {
94
100
  val config = repo.config
101
+ var dirty = false
95
102
  val current = config.getString("protocol", null, "version")
96
103
  if (current != "0") {
97
104
  config.setString("protocol", null, "version", "0")
105
+ dirty = true
106
+ }
107
+ // Limit pack memory to avoid OOM on push
108
+ // pack.windowMemory: max bytes for delta search window (per thread), default unlimited
109
+ if (config.getLong("pack", "windowmemory", 0) == 0L) {
110
+ config.setLong("pack", null, "windowmemory", 10L * 1024 * 1024) // 10MB
111
+ dirty = true
112
+ }
113
+ // pack.deltaCacheSize: total delta cache, default 50MB
114
+ if (config.getLong("pack", "deltacachesize", 50L * 1024 * 1024) >= 50L * 1024 * 1024) {
115
+ config.setLong("pack", null, "deltacachesize", 5L * 1024 * 1024) // 5MB
116
+ dirty = true
117
+ }
118
+ // pack.threads: limit to 1 to reduce memory pressure
119
+ if (config.getInt("pack", "threads", 0) == 0) {
120
+ config.setInt("pack", null, "threads", 1)
121
+ dirty = true
122
+ }
123
+ // pack.window: reduce from 10 to 5
124
+ if (config.getInt("pack", "window", 10) > 5) {
125
+ config.setInt("pack", null, "window", 5)
126
+ dirty = true
127
+ }
128
+ if (dirty) {
98
129
  config.save()
99
130
  }
100
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-tiddlywiki-filesystem-android-external-storage",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Expo native module for TidGi-Mobile: filesystem I/O + TiddlyWiki .tid/.meta/.json batch parsing + git status in Kotlin (Android) and Swift (iOS)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",