Bug 157682 - Runaway malloc memory usage in this simple JSC program
Summary: Runaway malloc memory usage in this simple JSC program
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-05-13 14:10 PDT by Geoffrey Garen
Modified: 2016-05-13 15:21 PDT (History)
7 users (show)

See Also:


Attachments
Patch (1.64 KB, patch)
2016-05-13 14:17 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (1.64 KB, patch)
2016-05-13 14:20 PDT, Geoffrey Garen
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2016-05-13 14:10:54 PDT
Runaway malloc memory usage in this simple JSC program
Comment 1 Geoffrey Garen 2016-05-13 14:17:33 PDT
Created attachment 278865 [details]
Patch
Comment 2 Geoffrey Garen 2016-05-13 14:20:43 PDT
Created attachment 278866 [details]
Patch
Comment 3 Mark Lam 2016-05-13 14:21:38 PDT
Comment on attachment 278866 [details]
Patch

r=me
Comment 4 Geoffrey Garen 2016-05-13 14:23:42 PDT
Committed r200884: <http://trac.webkit.org/changeset/200884>
Comment 5 Geoffrey Garen 2016-05-13 15:21:25 PDT
<rdar://problem/25942874>
Comment 6 Geoffrey Garen 2016-05-13 15:21:50 PDT
BTW, here is the program:

#include <JavaScriptCore/JavaScriptCore.h>
#include <stdio.h>
#include <sys/time.h>

static double currentTime()
{
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return tv.tv_sec + tv.tv_usec / 1000. / 1000.;
}

int main(int argc, char** argv)
{
    JSContextGroupRef group;
    double before, after;
    unsigned i;
    
    group = JSContextGroupCreate();
    
    before = currentTime();
    
    for (i = 0; i < 100000; ++i)
        JSGlobalContextRelease(JSGlobalContextCreateInGroup(group, NULL));
    
    after = currentTime();

    printf("That took %lf ms.\n", (after - before) * 1000.);
    
    return 0;
}