Skip to content

Dynamic output memory leak #841

@Chornomor78

Description

@Chornomor78

On Windows 11, node.js v20.14.0 I have a memory leak in the case of dynamic output:

const {GPU} = require('gpu.js');
const gpu = new GPU();

const test = gpu.createKernel(function() {
	return 1;
}).setDynamicOutput(true);

for (let i=0; i<1e6; i++) {
	const size = 100; // we can generate a random output size

	test.setOutput([size]); // without this line memory doesn't leak

	const sum = test().reduce((a,e)=>a+e); // use the result

	if (i % 1000 == 0)
		console.log(i + ": " + sum); // debug logging
}

Memory leak can be seen in Task Manager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions