memory leak? memory leak?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

memory leak?

Started by CapriSkye, December 27, 2004, 08:37:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CapriSkye

one of my forums user is having this memory problem. he said that whenever someone visit his gallery, his memory useage would go up and eventually crash his computer. he tried to make the gallery unaccessible by renaming the folder, then everything would be okay.
he's using php 5.02 and mysql 4.1.7, with cpg 1.3.2. his gallery is functioning properly though, just the memory problem.
this is his debug info:

USER:
------------------
Array
(
    [ID] => 19bbae69fd51f7a832b9b8bf7710a2db
    [am] => 1
    [liv] => Array
        (
           
=> 75
            [1] => 417
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_group] => 1
    [user_active] => YES
    [user_name] => Redd
    [user_password] =>
    [user_lastvisit] => 2004-12-27 15:00:00
    [user_regdate] => 2004-11-15 00:06:10
    [user_group_list] =>
    [user_email] =>
    [user_website] =>
    [user_location] => 台灣
    [user_interests] =>
    [user_occupation] =>
    [user_actkey] =>
    [user_favpics] =>
    [disk_max] => 20480
    [disk_min] => 20480
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 1
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 1
    [priv_upl_need_approval] => 1
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 20480
    [can_see_all_albums] => 1
    [group_id] => 1
    [groups] => Array
        (
            [1] => 1
        )

)

==========================
Queries:
------------------
Array
(
   
=> SELECT extension, mime, content FROM redd_filetypes;
    [1] => SELECT * FROM redd_users WHERE user_id='1'AND user_active = 'YES' AND user_password != '' AND BINARY MD5(user_password) = 'aac2d932dd44ce18da4019b5dbee8a05'
    [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM redd_usergroups WHERE group_id in (1)
    [3] => SELECT group_name FROM  redd_usergroups WHERE group_id= 1
    [4] => DELETE FROM redd_banned WHERE expiry < 1104130836
    [5] => SELECT * FROM redd_banned WHERE ip_addr='61.223.44.248' OR ip_addr='61.223.44.248' OR user_id=1
    [6] => SELECT cid, name, description, thumb FROM redd_categories WHERE parent = ''  ORDER BY pos
    [7] => SELECT aid FROM redd_albums as a WHERE category>=10000
    [8] => SELECT count(*) FROM redd_pictures as p, redd_albums as a WHERE p.aid = a.aid AND category >= 10000
    [9] => SELECT cid, name, description, thumb FROM redd_categories WHERE parent = '1'  ORDER BY pos
    [10] => SELECT aid FROM redd_albums WHERE category = 2
    [11] => SELECT count(*) FROM redd_pictures as p, redd_albums as a WHERE p.aid = a.aid AND category = 2
    [12] => SELECT count(*) FROM redd_albums as a WHERE category = '2'
    [13] => SELECT a.aid, a.title, a.description, visibility, filepath, filename, url_prefix, pwidth, pheight FROM redd_albums as a LEFT JOIN redd_pictures as p ON a.thumb=p.pid WHERE category=2 ORDER BY a.pos LIMIT 0,6
    [14] => SELECT aid, count(pid) as pic_count, max(pid) as last_pid, max(ctime) as last_upload FROM redd_pictures WHERE aid IN (9, 8, 5, 7, 14, 15) AND approved = 'YES' GROUP BY aid
    [15] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='410'
    [16] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='488'
    [17] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='53'
    [18] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='482'
    [19] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='335'
    [20] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='77'
    [21] => SELECT cid, name, description, thumb FROM redd_categories WHERE parent = '2'  ORDER BY pos
    [22] => SELECT aid FROM redd_albums WHERE category = 3
    [23] => SELECT count(*) FROM redd_pictures as p, redd_albums as a WHERE p.aid = a.aid AND category = 3
    [24] => SELECT count(*) FROM redd_albums as a WHERE category = '3'
    [25] => SELECT a.aid, a.title, a.description, visibility, filepath, filename, url_prefix, pwidth, pheight FROM redd_albums as a LEFT JOIN redd_pictures as p ON a.thumb=p.pid WHERE category=3 ORDER BY a.pos LIMIT 0,4
    [26] => SELECT aid, count(pid) as pic_count, max(pid) as last_pid, max(ctime) as last_upload FROM redd_pictures WHERE aid IN (10, 11, 12, 13) AND approved = 'YES' GROUP BY aid
    [27] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='485'
    [28] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='574'
    [29] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='442'
    [30] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM redd_pictures WHERE pid='477'
    [31] => SELECT cid, name, description, thumb FROM redd_categories WHERE parent = '3'  ORDER BY pos
    [32] => SELECT aid FROM redd_albums as a WHERE category = '0'
    [33] => SELECT count(*) FROM redd_albums as a WHERE 1
    [34] => SELECT count(*) FROM redd_pictures as p LEFT JOIN redd_albums as a ON a.aid=p.aid WHERE 1
    [35] => SELECT count(*) FROM redd_comments as c LEFT JOIN redd_pictures as p ON c.pid=p.pid LEFT JOIN redd_albums as a ON a.aid=p.aid WHERE 1
    [36] => SELECT count(*) FROM redd_categories WHERE 1
    [37] => SELECT sum(hits) FROM redd_pictures as p LEFT JOIN redd_albums as a ON p.aid=a.aid WHERE 1
    [38] => SELECT count(*) FROM redd_albums as a WHERE category = '0'
    [39] => SELECT COUNT(*) from redd_pictures WHERE approved = 'YES'
    [40] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, aid FROM redd_pictures WHERE approved = 'YES'  ORDER BY RAND() LIMIT 8
    [41] => SELECT COUNT(*) from redd_pictures WHERE approved = 'YES'
    [42] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid,title, caption, owner_id, owner_name, aid FROM redd_pictures WHERE approved = 'YES'  ORDER BY pid DESC  LIMIT 0 ,8
)

==========================
GET :
------------------
Array
(
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 5.0.2 - OK
------------------
mySQL version: 4.1.7-nt-max-log
------------------
Coppermine version: 1.3.2
==========================
Module: gd
------------------
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
==========================
Module: mysql
------------------
Active Persistent Links 0
Active Links 1
Client API version 3.23.57
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.1.4
Linked Version 1.1.4
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .;C:\PHP\PEAR | .;C:\PHP\PEAR
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | redd@******.com | redd@******.com
sendmail_path | no value | no value
SMTP | www.******.com | www.*****s.com
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 45 | 45
max_input_time | 90 | 90
upload_max_filesize | 4M | 4M
post_max_size | 12M | 12M
==========================
Page generated in 0.167 seconds - 43 queries in 0.021 seconds - Album set :


anyone know what the problem is? thank you

Tarique Sani

PHP scripts do not manage memory - that is done at the level of PHP language  (Zend Engine). Firther it is unlikely that there is a true memory leak - chances are that there are some mods (like watermark on the fly) which are consuming too much memory

More details on the setup would be of help
SANIsoft PHP applications for E Biz

CapriSkye

thanks for the reply, he's thinking maybe there are queries that aren't released in database? i'm not sure if it's cpg's problem since nobody else is having this problem, but he does say when he makes the gallery unaccessible memory won't go up.
also he doesn't have any mod installed, he does have some pictures in it, about 500 pics with around 100 users.
he's using imagemagick, with default settings i believe.

Tranz

See if upgrading PHP helps. Besides, from php.net:
QuotePHP 4.3.10 & 5.0.3 released!

[15-Dec-2004] The PHP Development Team would like to announce the immediate release of PHP 4.3.10 and PHP 5.0.3. These are maintenance releases that in addition to non-critical bug fixes address several very serious security issues. All Users of PHP are strongly encouraged to upgrade to one of these releases as soon as possible.

Joachim Müller

Quote from: CapriSkye on December 27, 2004, 09:17:21 AM[...]
he's thinking maybe there are queries that aren't released in database?
in PHP, you don't have to close the mySQL connection - it will close automatically. From http://www.php.net/manual/en/function.mysql-connect.php
QuoteThe link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close().


However, there might be an issue in relation to memory usage if you don't free the result. From http://www.php.net/manual/en/function.mysql-free-result.php
Quotemysql_free_result() only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution.
, although I can't see where this should apply in coppermine.

Joachim

CapriSkye

thank you all for the reply