Skip to content

Memory leak in ParseDN #487

@inteon

Description

@inteon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions