schedule 11 months agoSold Out!
Memory Leaks leading to undesired memory growth and exhaustion are most common production problems in enterprise Node applications. Closures, a powerful semantic feature in functional programs, used pervasively in Node programs are prominent sources of unanticipated leaks.
I will explain three most common use cases where Closures are used in Node. For each, a) sample code, b) the life-span of the Closure context and which variables the closure keeps live, iii) what memory is retained during the Closure life-span. The intention is to help audience understand Closure's execution environment, their implications to memory footprint, and help them develop efficient code.
Many recent problem determination exercises revealed that memory leaks are the most prevalent production issues, and debugging of them reveals that Closures play a major role in it. Disambiguating Closures and programming best practices around it, I believe the Node community will be able to apply it instantly in their day-to-day job. People with strong procedural and object oriented language background will find this information useful, in making the key differentiation between Closures and normal functions.