Running PHP script on the command line. Using Mac OSX, MAMP.

I have a script that imports a large number of users. The script can read through all the users and even output the results to files of active and inactive users. As a shortcut to putting them in the database I added a series to db_query commands to insert records into the users and profile_values tables. This works great for small numbers. However, when I put the full file in the script runs for a while and then throws out the following:

php(521) malloc: *** vm_allocate(size=1069056) failed (error code=3)
php(521) malloc: *** error: can't allocate region
php(521) malloc: *** set a breakpoint in szone_error to debug
Bus error

I can run the script on the full file of users without the db_query commands and it runs fine. So I think there is some issue with the db_query after about 150,000 users that starts to leak memory.
I didn't want to put this in as a bug since there isn't enough information for that but I wanted to share. The script uses the same array for each line of the file and the values from that array are used in the database inserts. I can write that array to a file for each user I just cannot do the inserts without encountering the allocate error.

Anybody have any ideas? I'm changing the script to output a file of SQL insert commands that I'll import with mysql so this isn't a show stopper for me. Just wanted to share. Script is attached. Warning this is a one time quick and dirty import script and not meant to look like "pretty" code ;-)

CommentFileSizeAuthor
hc_userConversionPrep01.php_.txt8.54 KBAnonymous (not verified)

Comments

ricabrantes’s picture

Status: Active » Closed (fixed)

No activity, Close..