Skip to content
Merged
Show file tree
Hide file tree
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: 5 additions & 0 deletions .changeset/curly-groups-ask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a bug where the Astro compiler wasn't freed at the end of the build. After the fix, the memory used by the compiler is now correctly freed at the end of the build.
10 changes: 9 additions & 1 deletion packages/astro/src/core/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ export class AstroBuilder {
runtimeMode: this.runtimeMode,
origin: this.origin,
pageNames,
teardownCompiler: this.teardownCompiler,
viteConfig,
key: keyPromise,
};
Expand Down Expand Up @@ -295,6 +294,15 @@ export class AstroBuilder {
this.settings.timer.end('Total build');
// Benchmark results
this.settings.timer.writeStats();

if (this.teardownCompiler) {
try {
const { teardown } = await import('@astrojs/compiler');
teardown();
} catch {
// Compiler teardown is best-effort — don't fail the build if it errors
}
}
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/astro/src/core/build/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export interface StaticBuildOptions {
origin: string;
pageNames: string[];
viteConfig: InlineConfig;
teardownCompiler: boolean;
key: Promise<CryptoKey>;
}

Expand Down
Loading