|
Author |
Message |
kepler
Junior WebHelper
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Wed Dec 31, 2003 4:24 pm (20 years, 3 months ago) |
|
Dear friends,
I have a script that reads a text database of over 300 MB; I've used the normal procedure to load the database:
open (list, "<$listdata") or &error("Unable to open the data file for reading");
flock list, 2;
@list=<list>;
close(list);
foreach $list(@list) {
etc
The problem is that several users ( about 10 ) tried to use the application at the same time and the server where my site is hosted went out of memory - they had to shutdown the system and reboot ( very impressive, no? )
Now, there must be a way for me to read one line from the file at the time ( so the memory loads one line at the time also ) - but honestly I don't know how.
Does anyone knows how I can do this?
This is very urgent.
Best regards,
Kepler |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed Dec 31, 2003 4:35 pm (20 years, 3 months ago) |
|
Sorry, can't help you, but I don't think the fact that the server can't open multiple instances of a 300mb file reflects badly on the hosting company. In fact I'm surprised they haven't kicked you off the server
Anyway, good luck with your problem . |
________________________________
|
|
|
|
jayant
Team Member
Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India
|
Posted:
Wed Dec 31, 2003 5:54 pm (20 years, 3 months ago) |
|
Code: | open (list, "<$listdata") or &error("Unable to open the data file for reading");
while($line = <list>) {
#do processing like checking etc.
# all code comes here, that was inside foreach
}
close(list); |
|
________________________________ Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test |
|
|
|
kepler
Junior WebHelper
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Wed Dec 31, 2003 9:26 pm (20 years, 3 months ago) |
|
Thank you very much jayant.
I never thought it was so simple.
Happy New Year.
Best regards,
Kepler |
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.132936 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |