diff --git a/thrift_reflection/descriptor_register.go b/thrift_reflection/descriptor_register.go index 47046d8..eeec033 100644 --- a/thrift_reflection/descriptor_register.go +++ b/thrift_reflection/descriptor_register.go @@ -227,6 +227,21 @@ func RegisterAST(ast *parser.Thrift) (*GlobalDescriptor, *FileDescriptor) { return gd, fd } +// ReleaseGlobalDescriptors release the global descriptor +func ReleaseGlobalDescriptors(gds ...*GlobalDescriptor) { + if len(gds) == 0 { + return + } + lock.Lock() + defer lock.Unlock() + for _, gd := range gds { + if gd == nil { + continue + } + delete(globalDescriptorMap, gd.uuid) + } +} + func generateShortUUID() string { uuid := make([]byte, 4) _, _ = rand.Read(uuid)