Bug 114824 - Garbage Collection of Typed Arrays Fails
Summary: Garbage Collection of Typed Arrays Fails
Status: RESOLVED DUPLICATE of bug 119064
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh Intel OS X 10.8
: P3 Major
Assignee: Nobody
Depends on:
Reported: 2013-04-18 13:05 PDT by Amit Kapadia
Modified: 2013-07-24 14:55 PDT (History)
5 users (show)

See Also:

Example of typed array initialization and failure of garbage collector. (638 bytes, text/html)
2013-04-18 13:05 PDT, Amit Kapadia
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Kapadia 2013-04-18 13:05:49 PDT
Created attachment 198755 [details]
Example of typed array initialization and failure of garbage collector.

Steps to reproduce the problem:

1. Define a function that initializes a typed array.
2. Execute the function.
3. Observe the typed array not being garbage collected when falling out of scope.

The garbage collector should release memory from all variables defined in the function closure.  Memory associated with the typed array is not released at any point during the life cycle of the web app.  Memory is not released on tab close, but only on application close.

Additionally, allocating a typed array seems to consume more memory than it should.  For example,

var arr = new Float32Array(268435456);

allocates 1 gigabyte for array storage; however, WebKit consumes ~4 GB.
Comment 1 Oliver Hunt 2013-04-20 11:32:57 PDT
Check on a webkit nightly, my testing shows this as fixed
Comment 2 Amit Kapadia 2013-04-22 08:20:51 PDT
Oliver, what type of tests did you conduct?

This is still an open issue on my end (using WebKit nightly).  If you open the Activity Monitor, you will see 500 MB allocated by "SafariForWebKitDevelopment Web Content".  This memory is not released until the application closes.
Comment 3 Amit Kapadia 2013-04-30 07:50:47 PDT
This bug also exists when initializing instances of ArrayBuffer.  Webkit nightly does not release memory until the application closes.
Comment 4 Alexey Proskuryakov 2013-07-24 11:12:48 PDT
See also: bug 119049.
Comment 5 Filip Pizlo 2013-07-24 14:55:52 PDT

*** This bug has been marked as a duplicate of bug 119064 ***