Skip to content

Commit 95c005b

Browse files
committed
releasing memory in apply diff
1 parent 53f94a7 commit 95c005b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/tools/applyDiffTool.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export async function applyDiffTool(
8787
return
8888
}
8989

90-
const originalContent = await fs.readFile(absolutePath, "utf-8")
90+
let originalContent: string | null = await fs.readFile(absolutePath, "utf-8")
9191

9292
// Apply the diff to the original content
9393
const diffResult = (await cline.diffStrategy?.applyDiff(
@@ -99,6 +99,9 @@ export async function applyDiffTool(
9999
error: "No diff strategy available",
100100
}
101101

102+
// Release the original content from memory as it's no longer needed
103+
originalContent = null
104+
102105
if (!diffResult.success) {
103106
cline.consecutiveMistakeCount++
104107
const currentCount = (cline.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1

0 commit comments

Comments
 (0)