Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Memory Leak in Swagger doc #379

Closed
maiconsi opened this issue May 8, 2020 · 3 comments · Fixed by #387
Closed

Memory Leak in Swagger doc #379

maiconsi opened this issue May 8, 2020 · 3 comments · Fixed by #387
Assignees

Comments

@maiconsi
Copy link

maiconsi commented May 8, 2020

Identify some memory leaks in the Swagger classes.
Follow the corrections.
File: Swag.Doc.pas
Line: 261
Result.AddPair(fDefinitions.Items[vIndex].Name, fDefinitions.Items[vIndex].JsonSchema.Clone as TJSONObject);


File: Swag.Doc.Defnition.pas
Line: 73

if Assigned(fJsonSchema) then
    FreeAndNil(fJsonSchema);

File: Swag.Doc.Path.Operation.RequestParameter.pas
Line: 208
vJsonObject.AddPair(c_SwagRequestParameterSchema, fSchema.JsonSchema.Clone as TJSONObject);
File: Swag.Doc.Path.Operation.Response.pas
Line: 147
vJsonObject.AddPair(c_SwagResponseSchema, fSchema.JsonSchema.Clone as TJSONObject);
Line: 189
fSchema.JsonSchema := pJson.Values[c_SwagResponseSchema].Clone as TJSONObject;

Source.zip

@joaoduarte19
Copy link
Collaborator

Can you provide an example that generates memory leaks? Because using the current version of SwagDoc I couldn't find any memory leaks.

@maiconsi
Copy link
Author

Hello, sorry for the delay.
You can actually use the DMVCFramework example "swaggerdoc".
The only difference is that I am using FastMM4.
I verified that if I don't use it, these errors don't occur, now I don't know if it's a delphi failure to not report this leak or FastMM4's failure!
Screenshot_69
Screenshot_68
Screenshot_67

@joaoduarte19
Copy link
Collaborator

Thanks for the contribution!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants