Re: [PHP-WIN] Next question about data output...<smile>
[email protected] ("Jacob Kruger")
| Newsgroups | php.windows |
|---|---|
| Message-ID | <0C6FB0A2EBF84A4F8B5378902C8E0686@JacobPC> |
OK, seems what's causing issue is imagecreatefromstring(), since, directly after retrieving longblob data from database, memory usage is: 3402136 = 3.*Mb and, then immediately after that calling: $imgOut = imagecreatefromstring($bOut); and, return that $imgOut variable to calling function, before do anything else, memory usage: 44063856 - 44Mb+ And, this is on my windows development machine, so seems issue is with operations, and not machine specific, although not sure why it's working on this machine, and not on production server. Either way, think will, for now, switch image output rendering back to simpler method that worked before, instead of using actual mysqli_statement, and see if works as such - might also put the memory usage 'logging' in there, to actually compare them, or something. Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: "Sascha Meyer" <[email protected]> To: "Jacob Kruger" <[email protected]> Sent: Friday, August 16, 2013 8:57 AM Subject: Aw: [PHP-WIN] Next question about data output...<smile> > Good morning Jacob, > > could you check if memory has been eaten up before the mysqli_statement is > executed? memory_get_usage() [1] could help in that case. Are you using > different PHP versions on your local dev machine and on the production > server? > > Best regards, > > Sascha > > [1] http://php.net/manual/en/function.memory-get-usage.php > >> Gesendet: Freitag, 16. August 2013 um 08:42 Uhr >> Von: "Jacob Kruger" <[email protected]> >> An: [email protected] >> Betreff: [PHP-WIN] Next question about data output...<smile> >> >> On my development, windows machine, the memory_limit iniValue is set to >> 128M, and on the production server - think linux box, it's set to 1280M, >> but, the bit of script to render an image from database as image resource >> to browser, works fine on my machine, but, on server, the following error >> occurs: >> PHP Fatal error: Allowed memory size of 1342177280 bytes exhausted (tried >> to allocate 4294967296 >> >> According to server log, it seems to be happening on the line where the >> mysqli_statement tries to execute the query to retrieve a longblob value >> of 2.1Mb, but anyway. >> >> I am making sure try to destroy any image resources, etc., am closing >> statement object after executing it, etc. - and there aren't really any >> recursive loops being executed, but, just a page instantiating an >> instance of a wrapper class, which then refers to the imageManipulation >> object, to then pull the images data out of the DB - thoughts? >> >> TIA >> >> Jacob Kruger >> Blind Biker >> Skype: BlindZA >> '...fate had broken his body, but not his spirit...' >> >