algorithm - PHP memory size issue -


hello need analyze around 50,063,860 combinations fantasy roster. it's 60 pick 6.

i trying generate possible combinations passing names array math_combinatorics pearl library:

$n array of 60 elements,

$result = $combinatorics->combinations( $n, 6);

fatal error: allowed memory size of 2147483648 bytes exhausted (tried allocate 72 bytes) in /usr/share/php/math/combinatorics.php on line 126

is there anyway allocate more memory or feed less entries @ 1 time not crash?

you can increase memory_limit in php.ini. php docs:

this sets maximum amount of memory in bytes script allowed allocate. helps prevent poorly written scripts eating available memory on server. note have no memory limit, set directive -1.

you can set value inline in script using ini_set() function or in apache virtual host configuration using php_value directive.

having said that, behoove refactor code such not permutations need in memory @ once, thereby drastically reducing program's memory footprint.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -