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

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

WBOY
Release: 2016-06-13 12:43:09
Original
893 people have browsed it

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

<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 />
Copy after login


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

多谢!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template