homepage Welcome to WebmasterWorld Guest from 23.23.8.131
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
does memory usage always increase
lethal0r

5+ Year Member



 
Msg#: 4418549 posted 12:09 am on Feb 17, 2012 (gmt 0)

function a iterates through itself, and can call function b.

memory usage slowly creeps up.

is it possible to have flat memory usage? it is my understanding that when a function ends, all the memory is freed up, but that does not seem to be the case here. there are no globals, no appending items to an array, b doesn't call a.

 

incrediBILL

WebmasterWorld Administrator incredibill us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4418549 posted 12:43 am on Feb 17, 2012 (gmt 0)

We're talking function and not class?

Did you invoke any classes within the function?

FWIW, not all memory releases really release memory in ways that are immediately visible via stats of all memory used, etc. depending on the OS, Windows, Mac, Linux?

lethal0r

5+ Year Member



 
Msg#: 4418549 posted 10:08 am on Feb 17, 2012 (gmt 0)

they are functions, and have not invoked any classes.

its running on linux.

im very new to the idea of keeping an eye on memory when coding, and I find it fascinating. ive set a lot of variables to NULL and have seen a big drop in the rate at which memory goes up.

memory_get_usage says it now increases at 100~ kilobytes with each iteration.

should I keep looking or is that a typical increase?

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4418549 posted 4:57 pm on Feb 17, 2012 (gmt 0)

100K per pass seems like a lot! :-) To put it in context, create 100 K image and look at it's size - depending on the compression method, this could easily be larger than any reasonable web browser viewport. Speaking of web pages, the "recommended" web page size is not to exceed 40K (but today, you're lucky to find one under 100K.)

Is there any way to flush any variables within this function? What is it doing that's using up 100K with each pass? Is it using global variables, or are all variables scoped to the function?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved