=== Memory Scan - PHP Memory Usage - No Crash ===
Contributors: service2client
Text Domain: memory-scan
Donate link: https://www.service2client.com/dynamic-post-donation
Tags: memory, performance, site health, memory limit, diagnostics
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.0
Stable tag: 1.0.0

License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Measures your site's real PHP memory headroom, ranks plugins by expected peak, recommends a memory_limit for your site type, and warns of a crash.

== Description ==

Memory Scan tells you, in plain terms, whether your WordPress site has enough PHP memory to run reliably — and warns you *before* a low-memory crash instead of after.

Rather than guessing from a single admin page (which is one of the lightest requests on a site), Memory Scan records the real peak memory of each request type — front-end, admin, AJAX and cron — and judges your headroom against your PHP `memory_limit` with a built-in safety margin.

**What you get:**

* **Real measured headroom** — based on the heaviest actual request seen, not a synthetic number.
* **Three at-a-glance metrics** — current headroom, recommended-for-your-site-type, and real peak by request — that escalate from "You're fine" to "Urgent" as memory gets tight.
* **Per-plugin expected-peak ranking** so you can see which plugins (page builders, SEO suites) demand the most memory. This figure is a deliberately conservative estimate, not a live measurement — WordPress cannot bill runtime memory to a single plugin — so it errs high to keep your site safe.
* **A recommended `memory_limit`** for your detected site type (simple blog, Elementor, WooCommerce, or a heavy stack).
* **A proactive warning** that appears on every admin page when memory is low — so you are told without hunting for it.
* **A `WP_MEMORY_LIMIT` check** that flags when it is set below your PHP `memory_limit`, with the exact `wp-config.php` line to fix it.

Memory Scan is read-only with respect to your content: it never changes your posts, pages, or other plugins' settings. It only reads memory figures and writes its own small diagnostic values.

== Installation ==

1. Upload the `memory-scan` folder to `/wp-content/plugins/`, or install it through the Plugins screen in WordPress.
2. Activate the plugin through the **Plugins** screen.
3. On first activation you'll be taken to the Memory Scan page. After that you can open it any time from the **Memory Scan** menu.
4. Browse a few pages and run your heaviest task so it can record real peaks, then reload the scan.

== Frequently Asked Questions ==

= Does this slow my site down? =

No. It records the memory peak at the end of each request (a couple of arithmetic operations), and only performs the heavier per-plugin scan on admin requests, cached hourly. Nothing extra runs on front-end page loads beyond recording a single number.

= Is the per-plugin "expected peak" an exact measurement? =

No, and it says so on screen. PHP cannot attribute runtime memory to an individual plugin from a single request, so the per-plugin figure is a conservative estimate based on each plugin's code size. It errs high on purpose, so you provision enough memory rather than too little. The overall verdict uses your real measured peak.

= It says my WP_MEMORY_LIMIT is below my PHP memory_limit. What do I do? =

The plugin shows the exact line to add to `wp-config.php`. That setting lives outside any plugin, so Memory Scan can only detect and advise, not change it for you.

= Does it change or delete any of my content? =

No. Memory Scan is read-only with respect to your content — it never touches posts, pages, or other plugins' settings.

== Screenshots ==

1. The Memory Scan overview: current headroom, recommended memory for your site type, and the escalation banner.
2. Real peak by request type and the per-plugin expected-peak ranking.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
