GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Nov-2002, 06:06
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

PHP Arrays, how big can they get?


I am just curious actually, the thought crossed my mind when I was thinking about doing something new and using arrays. But there's a possibility the array might even have to hold up to 100000 values - gasp! So, anyone know where I can get information like this?
  #2  
Old 23-Nov-2002, 04:20
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
Lightbulb

I think array size depend at memory_limit setting in php.ini.
Default memory_limit = 8M. I look around for alittle bit tonight and this was what I found. I hope it helps

Later
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #3  
Old 24-Nov-2002, 13:31
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
You must be careful, because it also depends on the limits of what php can handle for namespace memory handling because at extremely large sizes, reliability becomes questionable.

I fonud this today and I thought I would let you know.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #4  
Old 26-Nov-2002, 04:30
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
namespace memory? What is that?
  #5  
Old 26-Nov-2002, 10:04
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
I'm not that sure I was talking to someone about a week ago and thats what he told me. I'll try to found out wht he was talking about.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #6  
Old 26-Nov-2002, 10:12
Garth Farley Garth Farley is offline
Awaiting Email Confirmation
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
Namespace memory. I think it's got to do with PHP's parsing algorithm. As it looks through your php script, when it sees something like
PHP Code:

$variable = 4 


it places the string "variable" into a section of memory, along with a pointer to another bit of memory which stores "4".

The more memory your script eats up, the more dangerous it becomes that the PHP engine might bugger up & overwrite segments of memory already being used.

It's often a good idea to unset large arrays in your program once you've finished with them. PHP also supports multi-dimensional arrays, so a 10X10X10X10 4D array uses 10,000 slots, which can fill up memory very quickly.

Garth Farley
  #7  
Old 27-Nov-2002, 06:23
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Thanks guys, I think I should stick with saving the data in a database then...
  #8  
Old 10-Jan-2003, 12:24
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Junior Member
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
Exclamation

You also need to remember that large arrays can take a long time to execute and there is a time out limit which can be set in php.ini. The default is like 60 seconds, if a script hasn't completely run through in that time it bails.
  #9  
Old 13-Jan-2003, 11:01
Garth Farley Garth Farley is offline
Awaiting Email Confirmation
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
...and it also has a memory limit, I believe the default is 4mb.

GF
  #10  
Old 13-Jan-2003, 11:43
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Junior Member
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
I just looked in my php.ini and came up with:

memory_limit = 8M

I haven't changed this option so I guess in 4.3.0 8MB is the default...I don't know about older versions...
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimizing your web server with Turck MMCache for PHP JdS Web Hosting Forum 2 07-Jan-2004 08:48
apache2 - php cgi fehler - schleife inna Apache Web Server Forum 8 27-Nov-2003 10:55
[Linux] Installing PHP --with-mcrypt JdS Web Hosting Forum 0 20-Aug-2003 09:40
PHP in HTML jrobbio Web Design Forum 4 24-Jul-2003 07:05
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 17:14

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:33.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.