Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Should we use gpr_malloc in the C shim and/or double-check it for memory leaks? #134

Closed
MrMage opened this issue Feb 23, 2018 · 4 comments
Closed

Comments

@MrMage
Copy link
Collaborator

MrMage commented Feb 23, 2018

Given that I found a memory leak in metadata.c (and fixed it with #133), would it be advisable to do a full review of the entire C shim library for memory leaks?

Also, the GRPC de-initializers that sometimes get called use gpr_free. To be consistent with that, should we allocate all memory using gpr_malloc instead of malloc? I assume the two are currently interchangeable, but it might make sense to be consistent there to avoid trouble down the road.

WDYT?

@jingtianyilong
Copy link

Found memory leak with caller gpr_zalloc in alloc.c, when I call server with high frequency. Memory never get freed.

@MrMage
Copy link
Collaborator Author

MrMage commented Mar 19, 2018

Thanks for the info. Is that an issue specific to SwiftGRPC or in the underlying GRPC library, though?

@jingtianyilong
Copy link

I'm not sure actually. But the alloc.c located in SwifGRPC.xcodeproj/Sources/CgRPC/src/core/lib/support/
So I assume it's with SwiftGRPC.
When calling with high frequency, it generates tons of Malloc 32.0Kib according to the Profile Tool on XCode.
I've noticed that there is a free function in the alloc.h. But memory never actually get freed.

@MrMage
Copy link
Collaborator Author

MrMage commented May 29, 2018

I think I fixed most leaks I could find recently; closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants