Jump to content

[SOLVED] Arrays's General


niwa3836

Recommended Posts

Hi,

 

Hope I am posting this in the right place and someone feels able to help me design thinking.

 

I am getting on fine with PHP generally, however I have noticed that a few of my programs hammer the disks quite hard and therefore I would like to store lots in arrays whilst I do the number crunching. The question is how far can you push arrays. In the old days (15 years ago when I did my last real programming I used to call malloc to make sure that there was memory available for the arrays. I dont see this now in codes, is it still used.

So for instance how do I know (or can trap in code) whether an array of, lets say, 30,000 rows, or 10 fields or 20 chars each will cause some memory problems? What about 100,000?

Anyone know as its difficult to test and of course I guess every machine that runs the code (different types of servers with different memory etc) may react differently. Am I barking up a tree, or more like a small daisy?

Link to comment
Share on other sites

but how much memory do you allocate? From a design point of view do people actual do this, I havent changed any values as yet as want really to understand why and what to.

Is there an incode trap for a failure? As I say some of the records to wander to 100,000 and would love to know if safe to do so.

Link to comment
Share on other sites

By default PHP can consume up to 128MB, this can be changed from the php.ini (and/or your script) via the memory_limit directive.

 

I do believe PHP has a built in function for seeing how much memory your script is using, However I cant remember the name of the function.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.