Bug 131544 - cached scripts leak in non JIT mode
Summary: cached scripts leak in non JIT mode
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-04-11 09:40 PDT by abaldeva
Modified: 2014-04-11 23:38 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description abaldeva 2014-04-11 09:40:47 PDT
Hi,

If you build JavaScriptCore without JIT support, it leaks cached scripts. This can be verified by continuously reloading the sunspider test suite (any version would do).The C Loop interpreter path memory usage goes up to 200 MB within few minutes. The JIT path does not suffer from this problem. 

The reason for the leak is ENABLE(JIT) define around few destroy calls in Executable.h/cpp. For example, when a ProgramExecutable is created, it adds a ref to the JSC::SourceCode::m_provider. However, if you turn off JIT, the allocateCell ends up putting it in heap.allocateWithoutDestructor. Since the destructor/destroy is not called anymore, the ref leaks when JIT is not enabled.

I have verified that removing ENABLE(JIT) from 6 places in the Executable.h/cpp resolves this issue (around the destroy function declaration/implementation). 

Executable.h

class ExecutableBase - 
static const bool needsDestruction = true;
static const bool hasImmortalStructure = true;
static void destroy(JSCell*); + 1 around the definition

class NativeExecutable - 
static void destroy(JSCell*); + 1 around the definition 

class ScriptExecutable - 
static void destroy(JSCell*); + 1 around the definition 

Unfortunately, I am not set up to submit patches as described here(http://www.webkit.org/coding/contributing.html) however hopefully this is enough info to allow somebody else to land the patch.

Appreciate your help.

Thanks
Arpit
Comment 1 Radar WebKit Bug Importer 2014-04-11 23:38:40 PDT
<rdar://problem/16600116>