function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Juan SpagnoliJuan Spagnoli 

Batchable instance is too big

Hi! I'm looking for some info about "Batchable instance is too big" exception and I couldn't find nothing... Anyone have a clue about why this exception is triggered?

 

Thanks a lot! 

Best Answer chosen by Admin (Salesforce Developers) 
Juan SpagnoliJuan Spagnoli
I found the problem. The issue was the following:  My batch process had a global variable  which was keeping instances of lists of records that were created in each execution of the method "execute". Therefore I was unnecessarily accumulating records in memory and that caused the error "Batchable instance is too big" . 
 
I suggest you to check the status of the global variables after each execution and you may find the solution to your problem as well.

All Answers

willjwillj

I am also getting this error on my batch.  I had no problems for the past 3 months with my batch until today.

 

"Batchable instance is too big"

 

How do we overcomeo this error?

Prash2Prash2

Have you figured out what was causing this? We have also started seeing this with one of our batch.

 

Any information on the issue would be greatly appreciated!

 

Thanks,

Prashant

Juan SpagnoliJuan Spagnoli

Not yet... In my case is really odd because I'm not querying data from database, i'm getting the data from an external api using callouts. I'm imagining that the error is trigger because some var instance, maybe a collection, that has to many elements, but I'm not sure...  If I get the cause of this issue, i'll post it here.

 

Good luck. 

Juan SpagnoliJuan Spagnoli
I found the problem. The issue was the following:  My batch process had a global variable  which was keeping instances of lists of records that were created in each execution of the method "execute". Therefore I was unnecessarily accumulating records in memory and that caused the error "Batchable instance is too big" . 
 
I suggest you to check the status of the global variables after each execution and you may find the solution to your problem as well.
This was selected as the best answer
Robert TRobert T

How do I "check the status of the global variables after each execution"