On Wed, Feb 26, 2014 at 7:29 PM, Till Schneidereit <[email protected]> wrote: >> >> >> I have this working now. In the output I see quite a few lines of the >> >> "??? (1)" form, i.e. the NonBuiltinScriptFrameIter has zero elements. >> >> I'm not sure what this means... allocations triggered from within C++ >> >> code rather than JS code? >> > >> > Or in self hosted code, right? Maybe the iterator { value, done } >> > objects? >> >> I looked at a few stack traces. The ones I looked at were all C++ >> allocations, but some of them might be self-hosted code. > > Except for a very few cases - mostly Intl-related, I think - he self-hosted > code should be called by content code, so I think these should be pretty > rare. You could use the ScriptFrameIterator, which doesn't censor > self-hosted scripts' frames.
I changed it to ScriptFrameIter, and the number of allocations coming from self-hosted code was fairly small. So that wasn't it. I eventually worked out that most of these allocations from C++ code were due to structured cloning. pdf.js does document decoding in a worker, and then passes data to the main thread, which displays it in a canvas. Quite a lot of data gets passed, and the structures are fairly complicated -- arrays of arrays of objects, things like that. I'm in the process of flattening those data structures. Hopefully this will reduce memory consumption, speed up structured cloning, and reduce GC pressure. (If you're wondering how I worked this out: I used Valgrind to print a stack trace -- see https://blog.mozilla.org/nnethercote/2011/01/11/using-valgrind-to-get-stack-traces/ for how -- inside my object metadata callback whenever there wasn't a JS stack present. I then did some basic frequency analysis on the output and saw lots of JS_StructuredClone() and related stack frame entries.) Nick _______________________________________________ dev-tech-js-engine-internals mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

