websupport-sk / pecl-memcache

PHP Extension - Memcache module with support of newer PHP 7.x and PHP 8.x
https://pecl.php.net/package/memcache
Other
328 stars 101 forks source link

Memory Leak with 4.0.5.3 (PHP 7.4) #106

Open kwhat opened 2 years ago

kwhat commented 2 years ago

There appears to be a memory leak:

Sample Code:

<?php

function test() {
    echo memory_get_usage() . "\n";

    $memcache_obj = new Memcache();
    $memcache_obj->addServer('memcached.local' , 11211);

    echo memory_get_usage() . "\n";

    // None of this seems to make a difference.
    //$memcache_obj->close();
    //unset($memcache_obj);
}

while (true) {
    test();
    sleep(1);
}

Actual Output:

# php -f test.php 
392128
408184

405160
421136

418112
434408

431384
447360

444336
460312

457288
473264

470240
486216

483192
499168

496144
512120

509096
525072

Expected Output:

# php -f test.php 
392128
408184

392128
408184

392128
408184

392128
408184

392128
408184

392128
408184

392128
408184

392128
408184

392128
408184

392128
408184