I'm currently trying to debug the memory consumption of my NestJs app and running into some issues. As is, my app consumes around ~920 MB of RAM right after starting the app. The consumption does not go up significantly which leads me to believe that it's not a memory leak causing the memory consumption.
To get started, I'm trying to get to a point where the excess memory consumption does not happen. For this I commented out all consumed modules from app/module.ts
and removed the imports. I also commented out everything in main.ts
but the memory consumption is still the same.
app.module
export const appModuleMetaData: ModuleMetadata = {
imports: [
....
// AuthModule,
// ... -> I removed all modules
],
providers: [],
exports: [],
};
main.ts
async function bootstrap() {
const app = await NestFactory.create(AppModule);
// const configService = app.get(ConfigService);
// .... -> I removed everything here
await app.listen(8012);
}
bootstrap();
I'm trying to figure out what nest loads into memory on boot. My understanding would be that removing all the modules and clearing out main.ts
should result in a memory state of a newly created project. When I create a sample app however, it consumes only ~90 MB of Ram (after builing and running the compliled code).
I'm running NestJs from a monorepo but not in monorepo mode (in case that's important).
I'd love any help as I'm stuck.