Skip to content

Memory leak in JsSetCurrentContext #5017

@benjamin-bader

Description

@benjamin-bader

Hi folks,

I've noticed that JsSetCurrentContext seems to leak small amounts of memory; see the screenshot below for a backtrace from Instruments on macOS. We're using ChakraCore in a server process, and during stress testing yesterday I noticed that we were leaking memory. Instruments shows that JsSetCurrentContext calls appear to be the cause; all roads lead to ThreadContextTLSEntry in the backtraces.

Is it possible that there's some required cleanup that I'm missing here? In our current design, request threads "borrow" a runtime from a pool, so we end up calling JsSetCurrentContext at least once per request. Are we supposed to "un-set" the context when a thread is finished using a runtime?

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions