abusing memory, resources?

sharyn's picture

They have: 18 posts

Joined: Aug 2004

I am doing a call where I go into a directory and open up all the files found and call my database each time to check for either the existence or lack of.. The database gets called each time with a $DBlink = new DB; and opens up a connection to the database each time. The directory originally had 200000 files in it and the program kept halting up. I split the directory up into 10000 file chunks but it still halts up after a while.

My question is... am I using up all my memory or am I using up all my resources or none of the above and it's something else?

I do a mysql_free_result after every query and I do a mysql_close on the link after I'm done.

thank you,
sharyn

They have: 11 posts

Joined: Jan 2004

Are you closing each file when you finnish with them or does the server get a pile up of open files.

sharyn's picture

They have: 18 posts

Joined: Aug 2004

good question.. but all my files are being closed right after being read...

chrishirst's picture

He has: 379 posts

Joined: Apr 2005

Are you destroying the objects each time otherwise they will only be destroyed (and free the memory) when the script ends (or go out of scope).

Use unset($DBlink) to destroy them

Chris

Indifference will be the downfall of mankind, but who cares?
Venue Capacity Monitoring
Code Samples

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.