+ Start a Discussion

Generate pdf giving heap size error on VF page



My requirement is to generate a pdf on click of a button. This button makes a web service calls and just displays the result on pdf. I generate this pdf as rendered from VF page. 


The problem here is that if the records that are returend from the webservice is < 6000, then it works fine. If the records are > 6000, I am getting VF heap size governor limit error. 


We need to email this pdf to the logged in user. 


Any thoughts on this ?




Try to clear all list data your contains execpt which showing on VF page . It might be you extract the records in one list and passing the another list or wrapper class list on visualforce page. So you just need to clear first one after process all the records because VF page heap size calculate all list data contains in apex controller.