# "Allowed memory size exhausted" / out of memory

> A PHP memory error, "JavaScript heap out of memory", or out-of-memory kills on the Analytics tab: which limit you hit and how to fix it.

Source: https://veldhost.eu/docs/out-of-memory

Last verified: 2026-11-13

There are three different memory limits on a veldhost site, and each one fails in its own way. Find your message below, then the fix for that limit.

| What you see | Which limit |
| --- | --- |
| `PHP Fatal error: Allowed memory size of N bytes exhausted (tried to allocate …)` in **Logs** | PHP's limit for **one request** |
| `FATAL ERROR: … JavaScript heap out of memory` in **Logs** → **Application** | Your Node.js app's heap |
| **Out-of-memory kills** above zero on the **Analytics** tab | Your **site's** memory, set by your plan |
| A deploy that says **"The deploy ran out of memory and was stopped."** | The **build's** memory |

## Why it happens

- **PHP, per request.** Every PHP request may use a fixed amount of memory. The number in the message is that limit in bytes. One page that loads a huge query result, resizes a big image or runs a heavy import goes over it. The request dies with a white page or a 500, and other requests carry on.
- **The whole site.** Your site runs in its own container with the memory of your plan: 768 MB on Starter and 2 GB on Pro. The number of PHP workers is sized to fit it. When everything together needs more, the system stops a process to free memory, and the **Resources** section counts it as an out-of-memory kill.
- **Node.js.** We give your app a V8 heap that fits your plan, and a ceiling a little under your plan's memory. An app that goes over is stopped and started again, so visitors see 502s while it restarts.
- **The build.** Deploys from Git run your install, build and test commands on a separate build machine with a fixed memory budget. It does not grow with your plan.

## Fix it

1. **See which limit it is.** Open [Sites](https://manage.veldhost.eu/portal/sites), choose your site, then **Logs**. Set **Find** to `memory` and **Level** to **Errors**. Then open **Analytics** and scroll to **Resources**. Choose **7 days** and look at **Memory** (used, *of* your limit) and **Out-of-memory kills** (*"in this range; one means the memory limit was hit"*).
2. **A single PHP request.** The message names the file and line where memory ran out, which is usually the code doing too much at once. In your app: process large sets in batches (`chunk()` in Laravel, paged queries in WordPress) instead of loading everything. Only raise the limit for the one script that needs it, for example `ini_set('memory_limit', '512M')` at its top, or `WP_MAX_MEMORY_LIMIT` for WordPress admin pages.
3. **Out-of-memory kills, a few at a time.** Look at the **Memory** chart around the kill. A spike at the same time each day points at a cron job or a backup plugin. Run it less often, or in smaller pieces ([Cron jobs](https://veldhost.eu/docs/cron-jobs)).
4. **Memory always close to the limit.** Your site has outgrown its plan. Compare plans in [Plans and add-ons](https://veldhost.eu/docs/plans-and-add-ons). On Business, you choose the memory.
5. **Node.js heap.** Look for a cache or a list that only ever grows: an in-memory session store, an unbounded map, a request log kept in an array. Move caches out of the process, or cap them. Plan memory sets the heap size, so a bigger plan raises it.
6. **The build ran out.** Make the build lighter: switch off source maps for production, drop an unused heavy dependency, or build large parts in separate steps. Then deploy again. See [Build steps](https://veldhost.eu/docs/build-steps).

## Still stuck?

If **Out-of-memory kills** keeps rising while **Memory** looks low, [contact us](https://veldhost.eu/contact) with the site name and the time range. We can see which process was stopped.

## Related

- [White screen or "500 Internal Server Error"](https://veldhost.eu/docs/white-screen-or-500)
- [My site is slow](https://veldhost.eu/docs/site-is-slow)
- [Traffic and analytics](https://veldhost.eu/docs/site-analytics)
- [Plans and add-ons](https://veldhost.eu/docs/plans-and-add-ons)