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

Memory leak #13

Open
gwynnarth opened this issue Dec 2, 2016 · 1 comment
Open

Memory leak #13

gwynnarth opened this issue Dec 2, 2016 · 1 comment

Comments

@gwynnarth
Copy link

gwynnarth commented Dec 2, 2016

Hi,

When doing some performance comparisons I noticed that you extension increasingly consumes more memory with each iteration.

A simple test script:

<?php

for ($i = 0; $i < 10000000; $i++) {
	sha3(rand(), 256);
	if ($i % 1000 === 0) {
		echo memory_get_usage()/1048576 . " MB\n";
	}
}

Produces output as in the attached file: sha3mem.txt

Plotting it reveals that the increase is perfectly linear which indeed suggests a memory leak.

In contrast, when using sha1() hashing method the memory consumption remains constant.
Could you please take a look?

PHP 5.6.27 (cli) (built: Oct 17 2016 01:26:56)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Thanks,
Artur.

@ghost
Copy link

ghost commented Jun 15, 2017

I can confirm this running

PHP 7.1.6-2 (cli) (built: Jun 14 2017 05:31:31) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.6-2, Copyright (c) 1999-2017, by Zend Technologies

Output file sha3-memory-leak.log

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

1 participant