Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Nov 2013
    Location
    China
    Posts
    75
    Plugin Contributions
    0

    Default allowed memory size exhausted in functions_general.php on line 62

    1.5.5b,PHP Version: 5.6.28 MySQL 5.6.34

    Got the following error,i could not figure it out what's going on and where i made a mistake.

    Allowed memory size of 134217728 bytes exhausted includes/functions/functions_general.php on line 62

    .........

  2. #2
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: allowed memory size exhausted

    Line 62 is running a PHP function to parse some data, and it would seem that the data is massive in size.

    Most of the time that code is triggered by the zen_output_string_protected function, which takes data entered by the user and outputs it to the screen after sanitizing it to be sure malicious content hasn't been inserted or can't be exploited.

    Thus it suggests that your out-of-memory situation is a result of either receiving a *very* large amount of data from the user, or have a *very* large amount of data you're trying to output.

    I'm pretty sure it's a result of something you've altered your store to do, or plugins you've added. It's not something that occurs during normal Zen Cart use.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2013
    Location
    China
    Posts
    75
    Plugin Contributions
    0

    Default Re: allowed memory size exhausted

    Quote Originally Posted by DrByte View Post
    Line 62 is running a PHP function to parse some data, and it would seem that the data is massive in size.

    Most of the time that code is triggered by the zen_output_string_protected function, which takes data entered by the user and outputs it to the screen after sanitizing it to be sure malicious content hasn't been inserted or can't be exploited.

    Thus it suggests that your out-of-memory situation is a result of either receiving a *very* large amount of data from the user, or have a *very* large amount of data you're trying to output.

    I'm pretty sure it's a result of something you've altered your store to do, or plugins you've added. It's not something that occurs during normal Zen Cart use.
    Thanks for your reply,i used the folllowing php code to check memory usage,i got 218.3515625 kb ,can i solve the problem temperately if i increase it to 2GB,the allowed memory now is 128MB

    PHP Code:
    <?php
    function get_usage_in_kb(){
        echo 
    memory_get_usage()/1024.0 " kb \n";
    }

    class 
    Profiler
    {
        protected 
    $startTime 0;
        public function 
    timerStart(){
            
    $this->startTime microtime(true);
        }

        function 
    timerEnd(){
            echo 
    number_format( (microtime(true) - $this->startTime)*1000), ' ms';
        }
    }

    class 
    ProfilerHolder {
        protected 
    $profiler;

        public function 
    __constructProfiler $profiler ){
            
    $this->profiler $profiler;
        }
    }

    ini_set('memory_limit''1M');

    $profiler = new Profiler();

    $profiler->timerStart();

    get_usage_in_kb();

    $holder = new ProfilerHolder$profiler );

    $b null;

    /**
     * @return string
     */
    function make_dummy_data()
    {
        return 
    str_repeat"Hello|"114242 );
    }

    $a make_dummy_data();

    $data explode'|'$a ); // comment this after narrowing down that a lot of memory is being used here
    //$data = array(); // uncomment this and memory usage will drop

    $buffer = array();

    foreach( 
    $data as $key => $item ){
        
    $buffer[] = $item;
    }

    get_usage_in_kb();

    unset(
    $a);

    get_usage_in_kb();

    echo 
    memory_get_peak_usage(TRUE)/1024' kb'"\n";

    $profiler->timerEnd();

    unset( 
    $profiler );
    xdebug_debug_zval'profiler' );

    //var_dump( $holder );

  4. #4
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: allowed memory size exhausted

    Nowadays a typical server is set to PHP Memory Limit = 256 MB

    Suggest the server you are on be changed to use that or, if that not possible, change it in the php.ini file for your hosting account if you have one.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: allowed memory size exhausted

    Normal Zen Cart operation wouldn't require more than 32M or maybe burst to 64M.

    You need to narrow down exactly what you were doing when the problem was triggered. A complete stack-trace would be helpful, instead of just the line number of the last step.
    You also still haven't listed all the ways in which your site differs from original Zen Cart code.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Nov 2013
    Location
    China
    Posts
    75
    Plugin Contributions
    0

    Default Re: allowed memory size exhausted

    Quote Originally Posted by DrByte View Post
    Normal Zen Cart operation wouldn't require more than 32M or maybe burst to 64M.

    You need to narrow down exactly what you were doing when the problem was triggered. A complete stack-trace would be helpful, instead of just the line number of the last step.
    You also still haven't listed all the ways in which your site differs from original Zen Cart code.
    Thanks for your reply,it maybe have something to do with backup,i have my SQL database backup every on hour,that's maybe the problem,i have disable the backup temporarily,will check if the problem have been solved.

  7. #7
    Join Date
    Nov 2013
    Location
    China
    Posts
    75
    Plugin Contributions
    0

    Default Re: allowed memory size exhausted

    Quote Originally Posted by e-standard View Post
    Thanks for your reply,it maybe have something to do with backup,i have my SQL database backup every on hour,that's maybe the problem,i have disable the backup temporarily,will check if the problem have been solved.
    Problem still have not been solved,i have changed PHP version from 5.6.3 to 7.0.14,will follow up to see if the problem will be solved...

  8. #8
    Join Date
    Jul 2012
    Posts
    16,799
    Plugin Contributions
    17

    Default Re: allowed memory size exhausted

    Quote Originally Posted by e-standard View Post
    Problem still have not been solved,i have changed PHP version from 5.6.3 to 7.0.14,will follow up to see if the problem will be solved...
    Not likely to resolve the issue.

    When you upgraded this database, how did you do the upgrade of the files?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Nov 2013
    Location
    China
    Posts
    75
    Plugin Contributions
    0

    Default Re: allowed memory size exhausted

    Quote Originally Posted by mc12345678 View Post
    Not likely to resolve the issue.
    When you upgraded this database, how did you do the upgrade of the files?

    Thanks very much for your help ,I update my zencart from 1.3.9 to 1.5.5b,here is what i am doing:

    upload zencart 1.5.5a file and install to update the website,when promote update, i just updated it. Am i missing anything?it seems i did not update the database from 1.5.5a to 1.5.5b,i just update some files...

    Zen Cart 1.5.5b
    Database Patch Level: 1.5.5
    v1.5.5a [2016-07-07 22:11:43] (Version Update 1.5.4->1.5.5a)
    v1.5.4 [2016-07-07 22:11:39] (Version Update 1.5.3->1.5.4)
    v1.5.3 [2016-07-07 22:11:38] (Version Update 1.5.2->1.5.3)
    v1.5.2 [2016-07-07 22:11:36] (Version Update 1.5.1->1.5.2)
    v1.5.1 [2016-07-07 22:11:34] (Version Update 1.5.0->1.5.1)
    v1.5.0 [2016-07-07 22:11:32] (Version Update 1.3.9->1.5.0)
    v1.3.9f [2011-11-21 16:38:07] (Fresh Installation)
    v1.3.9f [2011-11-21 16:38:07] (Fresh Installation)

    The funny thing right now is i got a new memory problem at the following address

    PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /home/estanda1/public_html/includes/classes/db/mysql/query_factory.php on line 45

  10. #10
    Join Date
    Jul 2012
    Posts
    16,799
    Plugin Contributions
    17

    Default Re: allowed memory size exhausted

    It's not really a new message, just an indication that 1) increasing the memory size didn't solve anything and 2) that there remains something causing a problem.

    So, when you described the process of upgrading, did the new ZC 1.5.5 files get put into their own clean empty directory, or did they overwrite other files in the directory? Reason I ask is because of the potential of various php files that may have remained behind or be causing some of the issues seen.

    Typical question to assist identifying the cause is: how is the fileset of your store different from a vanilla install of that version of the store? What extra files are there? What files are missing, how are they modified?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 61
    Last Post: 3 Jan 2017, 08:57 AM
  2. Replies: 12
    Last Post: 17 Mar 2014, 11:10 PM
  3. Replies: 11
    Last Post: 12 Feb 2013, 10:04 PM
  4. Allowed Memory Size Exhausted
    By SFAShop in forum General Questions
    Replies: 2
    Last Post: 20 Mar 2010, 10:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR