Closed maxchen33 closed 4 months ago
I would not recommend that approach regardless of memory leaks or not.
Creating a connection pool is slow and not intended to be done in the way your describe.
see relevant docs: https://github.com/tediousjs/node-mssql?tab=readme-ov-file#advanced-pool-management
Hi guys, as mentioned in description, we have a usecase which requires us to connect to a different database, therefore we are creating a new sql.ConnectionPool() with different config settings on each query request in the express route.
After the request is finished, we will execute .close() to all all active connections. I have a few questions:
Will the memory for each of the new ConnectionPools be freed eventually by the garbage collector, since we are calling .close() to close all active connections in each of the new Connection Pools. After the query, the new Connection Pool is no longer needed or referenced.
Will there be any strong references to the config objects used in the new Connection Pool or other objects whose memory cannot be fully released.
Will this approach causes any memory leaks? Thank you
Appreciate your kind responses and help. Thank you!