When trying to make a simple update conversion for a picklist, im getting heap size error. i'm ussing batch size = 1, and 13 rows only, wath could make it happen?



ERROR 00kd000000MMvRSAA1 OpportunityLineItemTrigger: System.LimitException: Apex heap size too large: 17780923

this is my trigger being executed by the dataLoader

trigger OpportunityLineItemTrigger on OpportunityLineItem (before insert, before update,before delete,after insert,after update,after delete, after undelete) {
  public static boolean OLiObj = false;
  /*  if(OM_R1_Opportunity_Clone_Controller.FLAG_RECURSION_OPP_CLONE){
      }  */
      String[] objs;
      Bypass__c profileCustomSetting = Bypass__c.getInstance(UserInfo.getUserId());

      if(profileCustomSetting != null){
        if(profileCustomSetting.Trigger_Objects__c != null){objs = profileCustomSetting.Trigger_Objects__c.split(UTIL_Constants.SEMICOLON);}
          if(objs != null){ for(string obj:objs){
            if(obj == 'OpportunityLineItem' && profileCustomSetting.bypass__c){OLiObj = true;}          

OpportunityLineItemTriggerHandler handler = new OpportunityLineItemTriggerHandler();

/**Before Insert Event*/
if(Trigger.isInsert && Trigger.isBefore){
/**After Insert Event*/
else if(Trigger.isInsert && Trigger.isAfter){
/**Before Update Event*/
else if(Trigger.isUpdate && Trigger.isBefore){

It's runing on handler.

public void onBeforeUpdate(List<OpportunityLineItem> newOpportunityLineItemList,List<OpportunityLineItem> oldOpportunityLineItemList){  

    if(!OM_R1_Utilities.isConversionUser()){ //sandeep.p.kuma Bug #241095: COnversion team is not able to write into Target Margin field on OpportunityLineItem
  • Can you please just update that record from apex or direct manual way check if you are getting that error or not? Also please confirm where you are getting such errors. (Directly from data loader ui or in error.csv file.) – Kiran Machhewar Dec 9 '15 at 18:59
  • 1
    You have a trigger called OpportunityLineItemTrigger that's using too much memory. We need to see code if you want us to help you. Either you're querying too much data, making really large data structures, or something else, but we'd have no way of knowing without seeing some code. – sfdcfox Dec 9 '15 at 19:09
  • Im getting this directly from Dataloader ui. – CrispuSF Dec 9 '15 at 19:12
  • Almost certainly a large query in OpportunityLineItemTrigger is the culprit. – Adrian Larson Dec 9 '15 at 19:17
  • Despite it being from the DataLoader UI, the trigger is still getting executed in your Org. – HungryBeagle Dec 9 '15 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.