Home >Backend Development >PHP Tutorial > 好手帮忙看一段代码,为什么内存耗尽

好手帮忙看一段代码,为什么内存耗尽

WBOY
WBOYOriginal
2016-06-13 12:43:09887browse

高手帮忙看一段代码,为什么内存耗尽

<br />
$i = -1;<br />
while( $i++ < 495000000 ) {<br />
        $rand_uid = rand(100000000,105000000);<br />
        $rand_fuid = rand(100000000,999999999);<br />
        $tab_name = get_hash_table('friends',$rand_uid);<br />
        $up_array = array(<br />
                                'uid' => $rand_uid,<br />
                                'fuid' => $rand_fuid<br />
                );<br />
        insert_table($tab_name, $up_array,1);<br />
}<br />


需要测试数据,要把5亿条数据写入到500个mysql表里面,直接用php命令执行的代码,为什么会内存耗尽?

多谢!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn