dadamssg87 Posted August 30, 2011 Share Posted August 30, 2011 I'm worried i'm trying to fit too much data into php and have no idea how to check. I have a script that pulls data from 18 database tables and stores the rows in variables, then my script uses that information to determine what to put in a new array. The new array has arrays in arrays. A typical item in the array will have around 2500 characters. The array will most likely contain 1 to 30 items. Is that too much? How should i go about testing the limits? Is there a way in php to measure how much ram you're using in a particular script? Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/ Share on other sites More sharing options...
AyKay47 Posted August 30, 2011 Share Posted August 30, 2011 memory_get_usage or memory_get_peak_usage Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1263651 Share on other sites More sharing options...
dadamssg87 Posted August 30, 2011 Author Share Posted August 30, 2011 nice. didn't know those functions existed. So i'm running php 5.3.2 so have 128M(134,217,728 bytes) to use. I just ran the memory_get_usage() function and it returned 926,312 and the memory_get_peak_usage() returned 969,108. guess i'm looking fine thus far Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1263655 Share on other sites More sharing options...
AyKay47 Posted August 30, 2011 Share Posted August 30, 2011 not an easy task to fill up the allocated memory Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1263657 Share on other sites More sharing options...
dadamssg87 Posted August 30, 2011 Author Share Posted August 30, 2011 good to know. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1263660 Share on other sites More sharing options...
Adam Posted August 31, 2011 Share Posted August 31, 2011 While I wouldn't just update it willy nilly, you can increase the memory limit PHP imposes. You can either do it in your php.ini file (look for the "memory_limit" directive), which would mean all requests have that limit, or you can do it on a per-request basis using ini_set: ini_set('memory_limit', 'xxM'); Edit In-case you find yourself in that position, that is. Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1263854 Share on other sites More sharing options...
AyKay47 Posted August 31, 2011 Share Posted August 31, 2011 While I wouldn't just update it willy nilly, you can increase the memory limit PHP imposes. You can either do it in your php.ini file (look for the "memory_limit" directive), which would mean all requests have that limit, or you can do it on a per-request basis using ini_set: ini_set('memory_limit', 'xxM'); Edit In-case you find yourself in that position, that is. yeah, you of course want to compile your code wherever you can to decrease the memory that you are using.. just be careful when manually setting the memory limit.. Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1263864 Share on other sites More sharing options...
dadamssg87 Posted October 12, 2011 Author Share Posted October 12, 2011 i'm kind of noob, what exactly do you mean by "compile"? Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1278458 Share on other sites More sharing options...
Philip Posted October 12, 2011 Share Posted October 12, 2011 I think he meant optimize, not compile. Quote Link to comment https://forums.phpfreaks.com/topic/246050-storage-limits-of-php/#findComment-1278700 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.