Is a 128MB PHP memory limit a lot? -


today added new feature in content management system i'm building. depending on uploading image to, php resize image fit designated location. works quite well, when try upload larger image, in 3mb image, i'm getting fatal error:

fatal error: allowed memory size of 134217728 bytes exhausted  (tried allocate 42520 bytes) in... 

i'm thinking 128mb of memory quite lot, considering don't run much... @ least don't think so. tried allocate 42520 bytes resizing process, failed.

my question should (a) increase limit or (b) re-evaluate why i'm using memory in first place? 128mb number or large/too little?

thanks, ryan

resolution

i concluded 128mb resizing image , focused @ looking @ other options... exec() options, never took closer @ "sample" data. turns out, though large image 2.83mb, on 10000px wide. that's problem. :)

gd stores images bitmaps in memory, wouldn't rule out possibility jpg images (for example, high resolution, highly compressed), bitmap version quite large.

call memory_get_usage() right before open & start resizing image & see if amount of memory way big.

also fyi, when script says "(tried allocate 42520 bytes)", doesn't mean needed 42520 more bytes run successfully. means @ moment needed 42520 more bytes. bit later might have tried allocate more memory. so, adding 42520 more bytes memory total wouldn't have fixed anything.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -