I am looking for a memory leak in my nodejs application.
I have a suspect in the below code
const CRON_SCHEDULE = '*/15 * * * * *';
function myFunction() {
const someBigString = ""; // This will cause an error (y is not defined)
}
function scehdule() {
return schedule(
validate(CRON_SCHEDULE,
() => this.myFunction()
));
}
I have a code called schedule which is called on the initialisation of the app which uses node-cron library to schedule a job every 15 mins which calls my function which has a fairly big string.
As i understand the string (someBigStrig) is in function/local scope so it should garbage collected.