mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
(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:
10
document.go
10
document.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user