https://github.com/zcfan/terser-bug-demo
demo of a memory leaks bug cause by terser minifying.
https://github.com/zcfan/terser-bug-demo
Last synced: about 2 months ago
JSON representation
demo of a memory leaks bug cause by terser minifying.
- Host: GitHub
- URL: https://github.com/zcfan/terser-bug-demo
- Owner: zcfan
- Created: 2025-03-11T09:33:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-11T09:48:31.000Z (about 1 year ago)
- Last Synced: 2025-03-11T10:41:15.088Z (about 1 year ago)
- Language: JavaScript
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Demo of memory leaks after terser minifying
Credit to [this blog post](https://blog.meteor.com/an-interesting-kind-of-javascript-memory-leak-8b47d2e7f156).
Input is not leaking, `--compress module=true,inline=false` is combination of safe options, but result in memory leaks.
## `before.js` does not leak.
To verify it, run the following command:
```
$ node --inspect before.js
```
Open `chrome://inspect` and record a memory timeline.
## After minifying, the `after.js` leaks.
```
$ npm build
$ node --inspect after.js
```
Open `chrome://inspect` and record a memory timeline.

## With `reduce_vars=false` the `after.js` does not leak.
```
$ npm build:fixed
$ node --inspect after.js
```
Open `chrome://inspect` and record a memory timeline.
