Massive memory consuming when require('opentype.js') is run
See original GitHub issueMassive memory consuming when require(‘opentype.js’) is run in html of electron app I’m trying to use this library, but when I add
const opentype = require('opentype.js');
to my code. and It runs. but when I try to open DevTools it consumes all of my memory 5.6GB and it crashes.
I’m on a Electron project. I tried the code in the Main process and the renderer process and within the html code. All the same problem happens.
- I don’t have problems using other packages by require()
- I uninstalled opentype.js by npm and reinstalled several times. to see if I destroyed it somehow.
- If I try calling opentype.js in plain html, it works fine.
- try calling in express app process, it works fine also.
- I think it maybe an electron issue. Anyone who successfully used it in electron?
Environment
Version used: 0.8.0 Font used: none Node version: v8.10.0 Operating System and version (desktop or mobile): Windows 8.1/10, and OSX
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Don't load `hmtx` table until it's actually needed · Issue #135 ...
The hmtx table loads all glyph advanceWidth and leftSideBearing values, which is fine for small fonts but for large fonts this puts a...
Read more >Is it normal for Webpack to take over 9GB of memory?
It looks like your process takes 1GB, but since they are executed 8 times, as separate processes... then they take 8GB of ram....
Read more >nodejs with nginx proxy , memory usage - Server Fault
js may use 85-90% of all available memory but it runs super fast and there is nothing wrong. The high memory usage may...
Read more >opentype.js - npm
OpenType font parser. Latest version: 1.3.4, last published: a year ago. Start using opentype.js in your project by running `npm i opentype.js`.
Read more >Node.js Memory Leak Detection: How to Debug & Avoid Them
js uses Chrome's V8 engine to run JavaScript. Within V8, memory is categorized into Stack and Heap memory. Stack: Stores static data, method...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solved it by detuoring opentype variable through main process and passing it with
remote
module in electronbut still not sure why it doesn’t work directly in the renderer process I’ll notify when it all clears up.
@Jolg42 thanks again for advice
I won’t have the time to investigate this issue unfortunately but you should add a link to you repository if it’s public as an example.
I guess the best way to know what’s happening will be to record the memory consumption and see where it’s being allocated.
You could try: https://electronjs.org/docs/tutorial/debugging-main-process https://github.com/sindresorhus/electron-debug