Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/core/tools/applyDiffTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function applyDiffTool(
return
}

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

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

// Release the original content from memory as it's no longer needed
originalContent = null

if (!diffResult.success) {
cline.consecutiveMistakeCount++
const currentCount = (cline.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1
Expand Down