Activity Forums Salesforce® Discussions Heap size limit exceeded

  • Heap size limit exceeded

  • Abhinav

    Member
    April 14, 2016 at 8:49 am

    I am facing the issue heap size increased in the Batch class. I m trying to get more than 50,000 records from the 3rd party through batch classes. But when it run after some time the batch class fails and throws the error heap size exceeded. Any help..!

  • Rachit

    Member
    April 14, 2016 at 8:52 am

    Hi Abhinav,

    I think the issue over here is the use of for loop.You may be getting bulk data in for for loop and the logic may be taking long to execute.If provided the code then can get a more clear picture.

     

    Thanks

  • Parul

    Member
    September 17, 2018 at 10:49 am

    Hi Abhinav

    To avoid this error,Please review your code and follow best practices to ensure that the heap limit does not exceed the maximum.

    Note -: Salesforce enforces an Apex Heap Size Limit of 6MB for synchronous transactions and 12MB for asynchronous transactions, and if you exceed that limit, you will receive an error message.

    Thanks

     

  • shariq

    Member
    September 18, 2018 at 1:57 am

    Hi,

    Try to remove unwanted variables and loops. Optimize your code as much as possible, if not then try to change your logic if possible.

    Hop this helps.

Viewing 1 - 4 of 4 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos