Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bun.ArrayBufferSink leaks memory #15945

Open
Ikaleio opened this issue Dec 22, 2024 · 0 comments
Open

Bun.ArrayBufferSink leaks memory #15945

Ikaleio opened this issue Dec 22, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@Ikaleio
Copy link

Ikaleio commented Dec 22, 2024

What version of Bun is running?

1.1.42+50eec0025

What platform is your computer?

Linux 6.1.0-10-amd64 x86_64 unknown

What steps can reproduce the bug?

import Bun from 'bun'

function testMemoryLeak() {
	for (let i = 0; i < 1000000; i++) {
		let sink: Bun.ArrayBufferSink = new Bun.ArrayBufferSink()
		sink.start({
			asUint8Array: true,
			stream: true,
			highWaterMark: 1 * 1024 * 1024, // makes the leak more obvious
		})
		// sink.end() // uncomment this -> the leak will disappear
	} // variable "sink" should be GCed here

	setInterval(() => {}, 1000)
}

testMemoryLeak()

Bun will consume >1GB of memory.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@Ikaleio Ikaleio added bug Something isn't working needs triage labels Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant