There is a scheduled task that is executed every 5 minutes when using upsertMany to insert a large amount of data. I found that the memory increases every time a task is executed and the GC cannot reclaim the memory. How can I solve this problem?
Using nestjs, @mikro-orm/nestjs
this.emBi.upsertMany(SingleOrderSales, saveArry)
According to the officialdocumentation https://mikro-orm.io/docs/entity-manager, it seems that you need to manually execute the refresh command after finishing the work with the entity manager (also don't forget to wait). In your case: