최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday

티스토리 뷰

Clearing a Workbook from memory


메모리에서 문서를 삭제


PHPExcel객체는 순환 참조가 포함되어 있다.


(예를 들어 문서가 워크시트에 연결하고 워크 시트는 부모 문서로 연결된)


PHP에서 unset() 함수로 메모리를 취소하려고 하거나 로컬범위에 있는 함수의 끝에서 실행할경우


PHPExcel객체들은 PHP의 제한된 메모리의 많은 양을 사용할 수 있다. 메모리 누출이다.



오직 수동으로만 해결될 수 있다.


문서 설정을 해제해야하는 경우에, 이렇게 하기전에 이러한 순환 참조를 중단해야 할 필요가 있다.


PHPExcel은 disconnectWorksheets() 메서드를 제공한다.




$objPHPExcel->disconnectWorksheets();


unset($objPHPExcel);



Clearing a Workbook from memory

The PHPExcel object contains cyclic references (e.g. the workbook is linked to the worksheets, and the worksheets are linked to their parent workbook) which cause problems when PHP tries to clear the objects from memory when they are unset(), or at the end of a function when they are in local scope. The result of this is "memory leaks", which can easily use a large amount of PHP's limited memory.

This can only be resolved manually: if you need to unset a workbook, then you also need to "break" these cyclic references before doing so. PHPExcel provides the disconnectWorksheets() method for this purpose.

$objPHPExcel->disconnectWorksheets();

unset($objPHPExcel);


댓글