PelIfd::$maker_notes["parent"] is always $this (there is only one caller of PelIfd::setMakerNotes()). However, adding $this to the array leads to a reference of a PelIfd instance to itself. As a result that PelIfd instance can not be cleaned up right away after all references to it go away (as the ref_count remains at 1 - the one to itself). Only at garbage collection time the garbage cycle is detected and that instance is cleaned up.
This is an issue in case big images are processed one after another. In that scenario PelIfd::$maker_notes['data'] contains the full image data (i.e. multiple MB) and is only released upon garbage collection time - which is not right away. Garbage memory is piling up and running out of memory is easily possible and the program might crash with "Fatal error: Allowed memory size of xxx bytes exhausted".
PelIfd::$maker_notes["parent"]is always$this(there is only one caller ofPelIfd::setMakerNotes()). However, adding$thisto the array leads to a reference of aPelIfdinstance to itself. As a result thatPelIfdinstance can not be cleaned up right away after all references to it go away (as the ref_count remains at 1 - the one to itself). Only at garbage collection time the garbage cycle is detected and that instance is cleaned up.This is an issue in case big images are processed one after another. In that scenario
PelIfd::$maker_notes['data']contains the full image data (i.e. multiple MB) and is only released upon garbage collection time - which is not right away. Garbage memory is piling up and running out of memory is easily possible and the program might crash with"Fatal error: Allowed memory size of xxx bytes exhausted".