Thanks to visit codestin.com
Credit goes to github.com

Skip to content

INFO with optional argument #177

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

Merged
merged 1 commit into from
May 7, 2012
Merged

Conversation

michael-grunder
Copy link
Member

Nicolas,

Is this more reasonable? :)

Cheers,
Mike

nicolasff added a commit that referenced this pull request May 7, 2012
@nicolasff nicolasff merged commit 807f9cc into phpredis:master May 7, 2012
@nicolasff
Copy link
Member

That's great, thanks.

Regarding your comment about a memory leak: valgrind is not going to report memleaks from calls to emalloc, but --enable-debug will. I'm not sure how emalloc is implemented, but my guess is that PHP will keep track of such allocations and free them in its GC pass; this is why you have a different function to allocate data that is supposed to survive between requests. That's my understanding at least.

I will try to see if I can reproduce it.

@michael-grunder
Copy link
Member Author

I'm not sure if it is of any help, but I get the reported memory leak when simply running the unit tests with a php binary that has been compiled with --enable-debug

This is the report that I get:

/home/mike/dev/php-5.3.10/ext/redis/library.c(324) :  Freeing 0x7FAFEA5972C0 (79 bytes), script=TestRedis.php
Last leak repeated 5 times
=== Total 6 memory leaks detected ===

If I skip testZX by modifying the TestSuite::run() method to ignore that one, the memory leak goes away. However, if pull the whole testZX() method out into another script, it doesn't report a leak any more!

I was able to further narrow it down by progressively commenting lines in the testZX method, and I am pretty sure it has to do with zunion/inter with weights. The first line where a leak will be reported is 1770 in TestRedis.php, which is this:

$this->assertTrue(4 === $this->redis->zUnion('keyZ', array('key1', 'key2'), array(1, 1)));

Cheers,
Mike

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

Successfully merging this pull request may close these issues.

2 participants