Platform
The Winter '27 Apex heap increase: what your batch jobs can do now
Winter '27 raises the Apex heap ceiling to 10 MB synchronous and 25 MB asynchronous, and it switches on automatically. Here is what the extra room buys you, the sandbox setting that will bite a deployment, and why the old habits still matter.
For a decade the first thing I did when a batch job threw Apex heap size too large was cut the scope. From 200 records to 50, sometimes to 10, until the thing survived its own execute method.
Winter ‘27 gives some of that scope back. The synchronous heap limit rises from 6 MB to 10 MB, and the asynchronous limit from 12 MB to 25 MB, and you do not have to opt in. It turns on when your org upgrades.
If you own batch jobs that run a scope of 20 to dodge the heap wall, the useful move this release is to go back and measure what they can safely handle now. That is where the increase pays. Not in writing looser code, in reclaiming the scope you gave up to a limit that just doubled.
I will take what changed, what it buys in the jobs where heap was the binding constraint, the one setting that will surprise a team mid-deployment, and the parts of the old discipline that the bigger number does not retire.
What changed, exactly
Heap is everything your transaction holds in memory at once: query results, the collections you build from them, the strings you concatenate, a Blob you pulled from a ContentVersion, a JSON payload you are assembling for a callout. When the running total crosses the ceiling, the runtime throws a System.LimitException you cannot catch, and the whole transaction rolls back.
Winter ‘27 moves the ceiling:
- Synchronous transactions: 6 MB to 10 MB.
- Asynchronous transactions (Batch, Queueable, future, scheduled): 12 MB to 25 MB.
The new limits are enabled automatically on the Winter ‘27 schedule, which rolls out by instance. To find your org’s date, open Trust Status, search your instance, and read the maintenance tab. The release is API version 68.0, and there is no code change required to get the new ceiling.
Confirm it yourself rather than trusting a blog, mine included. Run two lines of anonymous Apex in each org:
System.debug('Ceiling: ' + Limits.getLimitHeapSize());
System.debug('In use: ' + Limits.getHeapSize());
getLimitHeapSize() returns the ceiling for the context you are in, and getHeapSize() returns what you are holding right now. Run them in production and in every sandbox you deploy from, and write the two numbers down. You are about to see why the pair matters.
Where the extra room pays
The increase is not a general speed-up. It helps exactly the code where heap, and not CPU time or SOQL rows, was the thing that failed. Four patterns come to mind.
Batch jobs you shrank to survive. Async goes from 12 MB to 25 MB, a bit more than double. A batch that materialised rich records into wrapper objects often had its scope dropped well under 200 just to keep the execute method under heap. Those are the jobs to revisit: raise the scope in Database.executeBatch(batchable, scopeSize), watch getHeapSize() against the new ceiling, and stop at a number with headroom.
Large callout responses. A wide JSON document from an external system lives on the heap three times over: the response string, the deserialised object graph, and whatever you build from it. These were constant offenders at 6 MB synchronous. The async contexts where those callouts belong anyway now carry 25 MB, which covers a lot of payloads that used to force pagination.
Document and Blob work. Base64 is heavy. Reading a file out of ContentVersion, generating a PDF, encoding an attachment for an email or an outbound API, each holds a large Blob and often a second encoded copy. More heap means fewer of those jobs have to be split into artificial chunks.
Reading Data 360 results into Apex. If you pull unified data back through SOQL or the Query API and hold the result set to transform it, the materialised rows live on the heap. A wider ceiling lets a single async run carry a larger slice before it has to page.
The setting that will bite a deployment
Brief your team on this one before the upgrade weekend, because it breaks an assumption everyone makes about sandboxes matching production.
Preview-track sandboxes get Winter ‘27 before production does. So a developer sandbox can be running the new 10 MB and 25 MB limits while the production org it deploys to is still on Summer ‘26 at 6 MB and 12 MB. Code that passes every test in the sandbox can throw Apex heap size too large the moment it runs in production, because production’s ceiling is lower. The sandbox lied to you, politely.
Salesforce ships a switch for exactly this. In a sandbox, Developer Edition, or scratch org, go to Setup, open Apex Settings, and turn on Enforce the Summer ‘26 Apex heap limit. With it enabled, the non-production org uses the old lower ceilings, so your tests fail in the sandbox, where failing is free, instead of in production.
Two things to know about that setting. It exists only in Winter ‘27 non-production orgs. And in Spring ‘27 the higher limits are enforced everywhere regardless of the setting, so the whole mismatch resolves itself one release later. For the Winter ‘27 window, though, if you are deploying from an upgraded sandbox into a not-yet-upgraded production org, turn it on. It is the cheapest insurance in the release.
What the bigger number does not fix
A doubled ceiling is not a license to stop thinking about memory, and I would rather say that plainly than let anyone read this as permission to load fifty thousand rows into a list “to be safe.”
More heap does not mean you can process more records in a transaction. The other governor limits did not move: still 100 synchronous SOQL queries, still 50,000 rows returned, still 10 seconds of synchronous CPU, still 150 DML statements. Stuff more into one execute and you will simply hit the next wall a little later, usually CPU, usually during your biggest data load.
The habits that kept code under 6 MB are the same ones that keep it fast, and they still apply:
- Use a SOQL for loop when you are iterating a large result set. It pulls records in batches of 200 and lets each batch fall out of scope, so you never hold the whole set at once.
- Query the fields you use, not
SELECTeverything. A wide query on a tall object is pure heap you did not need. - Let large variables go out of scope, or null them out, once you are done with them. A collection you keep referencing is a collection the runtime cannot reclaim.
- Reach for Platform Cache when the thing you keep rebuilding in memory is stable config that other transactions need too.
The way to read a heap error has not changed either. It is a symptom of a design that materialises more than it needs, and the fix is almost always to hold less, not to hold the same amount under a higher cap. The increase buys headroom for the jobs that were already lean and still ran out. It does not rescue the ones that were never bulkified.
What I would do this release
Three things, in order. Run Limits.getLimitHeapSize() in production and confirm the new ceiling is live before you rely on it. Pull up the batch jobs whose scope you cut over the years and re-measure how much they can take now, because that reclaimed throughput is the real prize.
And if any sandbox you deploy from is ahead of production on the upgrade, switch on Enforce the Summer ‘26 Apex heap limit until production catches up, so a passing test means what you think it means.
The nicest part is quiet. A class of errors that sent people paginating, chunking, and shrinking scope for a decade just got less common, for free, with nothing to configure. That does not happen often with governor limits. When it does, the move is to go collect the throughput you were forced to leave on the table, not to forget why you left it there.
Understanding the basics
What are the new Apex heap size limits in Winter ‘27?
The synchronous Apex heap limit increases from 6 MB to 10 MB, and the asynchronous limit (Batch, Queueable, future, and scheduled Apex) increases from 12 MB to 25 MB. The change is enabled automatically when your org upgrades to Winter ‘27, rolling out by instance on the release schedule. You can confirm the active ceiling in any org by running Limits.getLimitHeapSize() in anonymous Apex.
Do I need to change my code to get the higher heap limit?
No. The new limits apply automatically once your org is on Winter ‘27, with no code change and no setting to enable in production. The only setting involved is the opposite one: in a sandbox or scratch org you can turn on “Enforce the Summer ‘26 Apex heap limit” in Apex Settings to keep the old lower limits while the production org it deploys to is still on the earlier release.
Why does my code pass in the sandbox but hit a heap error in production?
Preview-track sandboxes receive Winter ‘27 before production, so a sandbox can be running 10 MB and 25 MB while production is still at 6 MB and 12 MB. Code that stays under the sandbox’s higher ceiling can exceed production’s lower one and throw Apex heap size too large. Enable “Enforce the Summer ‘26 Apex heap limit” in the sandbox during the upgrade window so it tests against production’s real ceiling. In Spring ‘27 the higher limits apply everywhere and the mismatch goes away.
Does more heap mean I can process more records per transaction?
Not reliably. Heap is only one governor limit, and the others did not change: you still get 100 synchronous SOQL queries, 50,000 rows, 10 seconds of synchronous CPU, and 150 DML statements. A transaction that loads more records now may clear the heap check only to fail on CPU or query rows instead. The bigger ceiling helps lean code that needed a little more room, not code that was skipping bulkification.
Re-measuring batch scopes, hunting the heap offenders in an org that has lived through a few migrations, or straightening out code that treats the sandbox as production’s twin, that is routine work for our managed-services team. If your org upgrades this month and you want the limit changes read against your real code, talk to us.