{"action":"created","issue":{"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/3701","labels_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/3701/labels{/name}","comments_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/3701/comments","events_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/3701/events","html_url":"https://github.com/bcit-ci/CodeIgniter/issues/3701","id":64275673,"number":3701,"title":"Session_files_driver's garbage collector memory issue","user":{"login":"dtmax","id":393327,"avatar_url":"https://avatars.githubusercontent.com/u/393327?v=3","gravatar_id":"","url":"https://api.github.com/users/dtmax","html_url":"https://github.com/dtmax","followers_url":"https://api.github.com/users/dtmax/followers","following_url":"https://api.github.com/users/dtmax/following{/other_user}","gists_url":"https://api.github.com/users/dtmax/gists{/gist_id}","starred_url":"https://api.github.com/users/dtmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtmax/subscriptions","organizations_url":"https://api.github.com/users/dtmax/orgs","repos_url":"https://api.github.com/users/dtmax/repos","events_url":"https://api.github.com/users/dtmax/events{/privacy}","received_events_url":"https://api.github.com/users/dtmax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-25T13:58:07Z","updated_at":"2015-03-25T16:19:33Z","closed_at":null,"body":"I have a lot of error messages like this:\r\n```\r\nPHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 32 bytes) in /var/www/...../system/libraries/Session/drivers/Session_files_driver.php on line 321\r\n```\r\nIt's because of **scandir()** function, it reads all session file names into an array, in this block of code:\r\n```\r\nif ( ! is_dir($this->_config['save_path']) OR ($files = scandir($this->_config['save_path'])) === FALSE)\r\n{\r\n\tlog_message('debug', \"Session: Garbage collector couldn't list files under directory '\".$this->_config['save_path'].\"'.\");\r\n\treturn FALSE;\r\n}\r\n```\r\nI think there should be another mechanism of session files storing/listing. May be to store them in three-like folder structure. In this case GC could use scandir() only for some of those subfolders.\r\n"},"comment":{"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/comments/86102391","html_url":"https://github.com/bcit-ci/CodeIgniter/issues/3701#issuecomment-86102391","issue_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/3701","id":86102391,"user":{"login":"dtmax","id":393327,"avatar_url":"https://avatars.githubusercontent.com/u/393327?v=3","gravatar_id":"","url":"https://api.github.com/users/dtmax","html_url":"https://github.com/dtmax","followers_url":"https://api.github.com/users/dtmax/followers","following_url":"https://api.github.com/users/dtmax/following{/other_user}","gists_url":"https://api.github.com/users/dtmax/gists{/gist_id}","starred_url":"https://api.github.com/users/dtmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtmax/subscriptions","organizations_url":"https://api.github.com/users/dtmax/orgs","repos_url":"https://api.github.com/users/dtmax/repos","events_url":"https://api.github.com/users/dtmax/events{/privacy}","received_events_url":"https://api.github.com/users/dtmax/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T16:19:33Z","updated_at":"2015-03-25T16:19:33Z","body":"Less than 100k, I think. Already moved to Redis driver."}}