(fix): A memory leak was detected and fixed #46

The issue lay with the `ExtractSpecInfo()` method from within the `datamodel` module. There is a round of parsing that happens in another thread inside there, and a notification is pumped down a channel once done. The pronlem is that nothing was listening on that channel, so everything in those threads just kept piling up with the garbage collector unable to free any of it.
This commit is contained in:
Dave Shanley
2022-12-13 13:56:03 -05:00
parent f61e731567
commit 724fdb31c4
2 changed files with 21 additions and 11 deletions

View File

@@ -84,6 +84,16 @@ func NewDocument(specByteArray []byte) (Document, error) {
d := new(document)
d.version = info.Version
d.info = info
// wait for json to be ready
// this needs to be deprecated at some-point
done := false
for !done {
select {
case <-info.JsonParsingChannel:
done = true
}
}
return d, nil
}