0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Salesforce】Apex heap size too large: XXXXXXXXのエラーを回避したい

Posted at

問題

Apexにてレコードを取得後、Visualforceの「xls」ファイルを出力していたが件名のように「Apex heap size too large: XXXXXXXXのエラー」と表示された。

こちらの回避方法はあるか?

解決策

Visualforce ページに表示されるレコードは Apex クラスによって取得された後にメモリに格納。

利用可能なメモリのサイズは下記ドキュメントに記載されている「ヒープの合計サイズ」が適用され、
今回のように同期処理の場合は 6MB。

ヒープの合計サイズ
同期 Apex の制限 : 6MB
非同期 Apex の制限 : 12MB

メモリ上に格納されるデータが多すぎる場合は今回のエラーが発生する。

一回で Visualforce ページに表示するレコードの件数を減らす。
または表示する項目や文字数を減らすのが回避策。

参考リンク

【Apex ガバナ制限】

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?