Why is the memory exhausted?
$i = -1;while( $i++ < 495000000 ) { $rand_uid = rand(100000000,105000000); $rand_fuid = rand(100000000,999999999); $tab_name = get_hash_table('friends',$rand_uid); $up_array = array( 'uid' => $rand_uid, 'fuid' => $rand_fuid ); insert_table($tab_name, $up_array,1);}
If we need to test the data, we need to write 0.5 billion pieces of data into 500 mysql tables and run the code directly using the php command. why is the memory exhausted?
Thank you!
Reply to discussion (solution)
I sent this before. I 'd like to pick it up!
Http://bbs.csdn.net/topics/390121151
No, but it's hard to say if your hard disk space is insufficient.
At least insert_table should be used to determine whether insertion is successful
I do not know the get_hash_table algorithm, but the data span of $ rand_uid is 5000000.
Batch execution to release memory
No, but it's hard to say if your hard disk space is insufficient.
At least insert_table should be used to determine whether insertion is successful
I do not know the get_hash_table algorithm, but the data span of $ rand_uid is 5000000.
Thank you for your reply!
The disk space is large enough, and I/O is normal.
Batch execution to release memory
The key is that I don't know which part consumes memory!
Take a look at it using the memory_get_usage function.
Batch execution to release memory
The key is that I don't know which part consumes memory!
I personally said that this code segment is basically no different from the endless loop, that is, it will be executed, and SLEEP in the loop body to see it
You 'd better paste both get_hash_tableh and insert_table!
I read the disk I/O. this is the cause.