Node.js cleared after requests?

I read that node.js is single-threaded, so it does not develop a new process or start a new thread for every HTTP request. But does the http module have a way to clear after closing each connection? For example, if I create an object inside a callback every time someone asks for a page, does this object destroy after the answer is answered and the connection is closed?

+6
source share
1 answer

Yes, this is true because of the review.

http.createServer(function(res) { var localobject = new BigObject(); ... res.end(); }); 

Upon completion of the function, BigObject is no longer used and is cleared by the garbage collector.

+7
source

Source: https://habr.com/ru/post/893826/


All Articles