We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • This only occurs when selecting specific links in the management panel.
    What links?
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
    • Are the pages that are triggering this doing some uncached Snippet calls or something that would trigger this?
      • These are Manager pages, Everett.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 18367
          • 834 Posts
          Quote from: AMDbuilder at Feb 21, 2013, 07:29 AM
          I'll agree with Mark you shouldn't need that much memory unless something is horridly wrong. Susan is right you should determine and fix the problem.


          Not getting in to that one. If I pursue it with the host they will say they don't support third party software and I should take it up with the vendor. If I take it up with the vendor they will say it's a problem with the host. End result you go round in circles, waste time and get no where.

          We've all been there.

          In any event it's fixed. Personally I think it was just one of those things that got fixed by a big hit.
            Content Creator and Copywriter
            • 3749
            • 24,544 Posts
            The point is that you may have a badly written snippet or plugin (or a circular reference like a getResources call in a page that includes that page's content) that's eating memory. It could bite you again, and even if it doesn't, it's not nice to be hogging resources you don't need. A snippet that checks the current memory usage could be handy in finding the problem.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 18367
              • 834 Posts
              Bob,

              yeh, but here's the thing. This was a fresh install with nothing added.

              What we ended up doing was ripping everything out, moving to a new server with the host and then doing another fresh install with extra memory.

              So whatever caused the problem on the earlier install may or may not have repeated itself in the new environment. Doesn't look like it so far.

              But I'll take your advice on monitoring the memory usage. Any snippet suggestions?
                Content Creator and Copywriter
                • 3749
                • 24,544 Posts
                Ah, in that case it sounds like you might have had a corrupted file in the install.

                This should get you started on a memory monitor (thought lexicon strings won't exist):

                <?php
                $mem_usage = memory_get_usage();
                
                /* your code here */
                
                $output .= "\n\n" . $modx->lexicon('mc_initial_memory_used') . ': ' . round($mem_usage / 1048576, 2) . ' ' .
                    $modx->lexicon('mc_megabytes');
                $mem_usage = memory_get_usage();
                $peak_usage = memory_get_peak_usage(true);
                $output .= "\n" . $modx->lexicon('mc_final_memory_used')
                    . ': ' . round($mem_usage / 1048576, 2) . ' ' .
                    $modx->lexicon('mc_megabytes');
                $output .= "\n" . $modx->lexicon('mc_peak_memory_used')
                    . ': ' . round($peak_usage / 1048576, 2) . ' ' .
                    $modx->lexicon('mc_megabytes');
                
                return $output;


                In your case, just logging peak memory usage to the MODX error log at various points might be enough.

                [[!MemCheck? &location=`Before getResources`]]
                [[!getResources? ... ]]
                [[!MemCheck? &location=`After getResources`]]
                




                <?php
                /* MemCheck snippet */
                $location = $scriptProperties['location'];
                $peak_usage = memory_get_peak_usage(true);
                $output .= $location . ' -- Peak Memory Used: ' . round($peak_usage / 1048576, 2) . '  Megabytes';
                $modx->log((MODX::LOG_LEVEL_ERROR, $output);


                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting