-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Memory leak with php extension #11632
Description
Hello,
I have a memory leak with the php extension with this simple code :
$clientRedis = new Serviceredis\ServiceRedisClient('localhost:10000', [ 'credentials' => Grpc\ChannelCredentials::createInsecure(), ]);
I think I manage to locate the leak, in php/lib/Grpc/BaseStub.php this part in the constructor
ChannelCredentials::setDefaultRootsPem($ssl_roots);
Link to this method PHP_METHOD(ChannelCredentials, setDefaultRootsPem) in php/ext/grpc/channel_credentials.c
There is a malloc there
default_pem_root_certs = gpr_malloc((pem_roots_length + 1) * sizeof(char)); memcpy(default_pem_root_certs, pem_roots, pem_roots_length + 1);
but I can not see free for default_pem_root_certs.
If I comment ChannelCredentials::setDefaultRootsPem($ssl_roots) in the constructor i don't have memory leak anymore.
Nginx + php fpm
nginx 1.12.0
php 5.6.30
grpc 1.4.0
protobuf 3.3.2
`
Debian 8.8 / kernel 4.9.0-0.bpo.2-amd64