Apex

Apex Heap Limits Are Bigger in Winter '27: 10MB Sync, 25MB Async

By Rishabh Panwar · Published 20 September 2026 · 5 min read · Intermediate

The “Apex heap size too large” error has a particular way of showing up in production and nowhere else — dev orgs carry less data, so the code that builds a large in-memory collection passes every test and then fails during a real batch run. Winter ‘27 gives that class of failure more room: the Apex heap limit rises to 10MB for synchronous transactions and 25MB for asynchronous ones.

The new numbers

  • Synchronous (triggers, controller actions, synchronous callouts): 6MB → 10MB
  • Asynchronous (Batch Apex, Queueable, future methods, scheduled Apex): 12MB → 25MB

The asynchronous jump is the significant one — more than double the previous ceiling. If you have shrunk batch scopes or added paging logic purely to stay under 12MB, that pressure eases considerably.

The setting that keeps sandbox deploys honest

The increase is enforced globally — there is no flag to turn it on. But Salesforce added a separate opt-in, “Enforce the Summer ‘26 Apex heap limit,” for a specific transition problem: a Winter ‘27 sandbox gets the new 25MB ceiling immediately, while a production org on the prior release still enforces the old one. Code written and tested against 25MB in the sandbox could then fail on deploy.

The setting lets a developer hold their sandbox to the old limit so sandbox behaviour matches what production will actually enforce. Per Salesforce’s Apex product team, it exists to make the transition controlled and is entirely at the developer’s discretion — it does not change the global enforcement, only your development environment’s ceiling.

Confirm your org’s limit at runtime

Do not assume the ceiling — read it. Limits.getLimitHeapSize() returns the maximum heap for the current transaction context in bytes:

System.debug('Heap ceiling (bytes): ' + Limits.getLimitHeapSize());
System.debug('Heap used (bytes): '    + Limits.getHeapSize());

Running this in a synchronous context versus a batch context is the quickest way to confirm which limit applies where.

What this does not change

More heap removes one failure mode; it does not remove the discipline. Heap is one governor limit among several, and SOQL row counts, query limits, and CPU time are untouched. A batch job that streams records and holds only what it needs is still better engineering than one that loads everything because it now can. The same efficient-query instincts covered in SOQL for loops and heap management still decide whether a large job succeeds — the higher ceiling just widens the margin before it doesn’t. If you are processing genuinely large volumes, the patterns in handling large data volumes in Apex matter more than the raw heap number.

For most orgs the practical effect is simple: fewer emergency interventions on batch jobs during volume spikes, and fewer workarounds written solely to manage memory.

Frequently asked questions

What are the new Apex heap limits in Winter '27?

Synchronous transactions rise from 6MB to 10MB, and asynchronous transactions from 12MB to 25MB. That is roughly a 66% increase for synchronous and a 108% increase for asynchronous contexts.

Do I have to opt in to the higher heap limits?

No. The increase is enforced globally regardless of any org setting. The separate 'Enforce the Summer '26 Apex heap limit' setting is an opt-in that lets you keep the old limit in a sandbox so code doesn't rely on headroom that production won't yet have.

Why would I keep the old heap limit in a sandbox?

To avoid writing sandbox code that passes at 25MB but fails when deployed to a production org still on the old ceiling. The setting keeps your development environment honest during the transition window.

How do I check my org's current heap limit in Apex?

Call Limits.getLimitHeapSize(), which returns the maximum heap size in bytes for the current transaction context. Compare it to Limits.getHeapSize() to see how much you have used.

Does a bigger heap limit mean I can stop bulkifying?

No. Heap is one governor limit among many. SOQL rows, query count, and CPU time still apply, so bulkification and query discipline matter as much as before. The extra heap reduces one class of failure, not the need for efficient code.

Which transactions count as asynchronous for the heap limit?

Batch Apex, Queueable jobs, future methods, and scheduled Apex run in the asynchronous context and get the 25MB ceiling. Triggers, controller actions, and synchronous web service calls use the 10MB synchronous ceiling.