Skip to content

Commit eb9c4aa

Browse files
authored
releasing memory in apply diff (#4193)
1 parent d079cb1 commit eb9c4aa

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
@@ -86,7 +86,7 @@ export async function applyDiffTool(
8686
return
8787
}
8888

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

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

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

0 commit comments

Comments
 (0)