Open IvanSanchez opened 7 years ago
My 2c, try running Gobble with either node-inspector or with node using the --inspect
. I believe the dev tools still has the profiler.
My experience with this was that it was caused by rollup. Dropping gobble-rollup in favor of basically inlining it in the gobblefile to get the most recent flavor of gobble stopped the OOMs for me.
@evs-chris Care to elaborate?
Thanks to @fskreuz 's suggestion, I can see that most of the memory (> 50%) is being taken up by magic-string
and its sourcemapLocations
.
But, unlike devtools in the browser, there are no good facilities for a memory allocation timeline, or filtering out circular references, so I can't be completely sure. Also taking a (big) heap snapshot fails :-/
It might be worth it to try and take heap snapshots with smaller projects, and see if the sourcemap chains grow up in memory consumption over time.
Ractive's build used to die about every 8th rebuild before we added changed the bundle step to basically what I linked. @fskreuz cleaned up the build quite a bit beyond that, but that along with pulling the latest version of rollup (at the time) seemed to fix the OOMs.
I was tempted to title this "out-of-memory kill", but it's V8's garbage collector who's killing my build.
Unfortunately I cannot share the conditions in which this is reproducible. It involves a (propietary) project which runs a rollupjs transform on top of mapbox-gl-js, in "watch" mode.
The first few times I run my pipeline, it works nicely...
Saving my files triggers a rebuild. Doing this an arbitrary amount of times while browsing the built project kills gobble sooner or later.
The stack traces don't tell me anything, really:
Judging by the stack traces, the problem is in the memory allocation of some Gobble code.
I also have experienced Gobble not dying gracefully when interrupted by
Ctrl+C
because there was an open socket to a browser. I'm gonna make a wild guess and say that Gobble is keeping in memory more copies of the files than it should.So the question is: How can I debug this further?