Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

The Resize method can cause memory leaks. #254

Open
oubenruing opened this issue Apr 23, 2023 · 0 comments
Open

The Resize method can cause memory leaks. #254

oubenruing opened this issue Apr 23, 2023 · 0 comments

Comments

@oubenruing
Copy link

Hi,
I found that using the Resize method can cause memory leaks during my usage. Here is a reproducible code snippet:

import gl from 'gl';

const context = gl(1, 1);

const ext = context.getExtension('STACKGL_resize_drawingbuffer');

ext.resize(Math.round(Math.random() * 10000), Math.round(Math.random() * 10000));
console.log(process.memoryUsage());

ext.resize(Math.round(Math.random() * 10000), Math.round(Math.random() * 10000));
console.log(process.memoryUsage());

ext.resize(Math.round(Math.random() * 10000), Math.round(Math.random() * 10000));
console.log(process.memoryUsage());

ext.resize(Math.round(Math.random() * 10000), Math.round(Math.random() * 10000));

console.log(process.memoryUsage());
global.gc();
console.log(process.memoryUsage());

The output is as follows:

D:\nodejs\node.exe --expose-gc .\test\serve\index.js
{rss: 172564480, heapTotal: 14258176, heapUsed: 10961088, external: 993382, arrayBuffers: 25834}
{rss: 254685184, heapTotal: 14528512, heapUsed: 11019784, external: 993494, arrayBuffers: 25906}
{rss: 464908288, heapTotal: 14528512, heapUsed: 11177264, external: 993566, arrayBuffers: 25978}
{rss: 548601856, heapTotal: 14528512, heapUsed: 11415536, external: 993670, arrayBuffers: 26082}
{rss: 545845248, heapTotal: 11382784, heapUsed: 8534216, external: 992516, arrayBuffers: 24970}

The RSS keeps increasing and the total memory usage does not decrease even after invoking GC manually.

Environment:
Microsoft Windows NT 10.0.19044.0 x64
node v18.15.0
gl 6.0.2

Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
NVIDIA GeForce GTX 1050

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant