Reputation: 15889
I'm trying to run the ff.
<?php
error_reporting(E_ALL);
set_time_limit(0);
ini_set('memory_limit', '-1');
$result = [];
$num = 100_000_000_000;
$salt = 'some random salt';
for ($i = 1; $i <= $num; $i++)
$result[crc32($salt.$i)] = true;
if (count($result) != $num)
echo 'Collision'.PHP_EOL;
else
echo 'Ok'.PHP_EOL;
But I hit the machine's limit and get
mmap() failed: [12] Cannot allocate memory
Fatal error: Out of memory
Is there a way to efficiently do this in terms of memory?
Upvotes: 1
Views: 64