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

Memory leak in ParseDN #487

Closed
inteon opened this issue Feb 20, 2024 · 0 comments
Closed

Memory leak in ParseDN #487

inteon opened this issue Feb 20, 2024 · 0 comments
Labels

Comments

@inteon
Copy link
Contributor

inteon commented Feb 20, 2024

The following snippet causes unexpectedly high memory usage:

func BenchmarkParseSubject(b *testing.B) {
	for n := 0; n < b.N; n++ {
		_, err := ldap.ParseDN("DF=#6666666666665006838820013100000746939546349182108463491821809FBFFFFFFFFF")
		if err == nil {
			b.Fatal("expected error, but got none")
		}
	}
}

Run with:

go test -bench=. -benchmem .

Result:

goos: darwin
goarch: arm64
pkg: .
BenchmarkParseSubject-12              58          20398892 ns/op        1665740367 B/op       58 allocs/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants