1. A method comprising: identifying, by a computer, in an intermediate representation of a script code, a plurality of occurrences of an increment code associated with an object, each of the occurrences of the increment code incrementing a reference count of the object when a programming construct refers to the object, the reference count indicating a number of references to the object; identifying, by the computer, a plurality of occurrences of a decrement code associated with the object, each of the occurrences of the decrement code decrementing the reference count of the object when a reference of a programming construct referring to the object is removed; analyzing, by the computer, the intermediate representation to identify an increment-decrement code pair, the increment-decrement code pair including an occurrence of the increment code that is adjacent to an occurrence of the decrement code in the intermediate representation; and removing, by the computer, the increment-decrement code pair from the intermediate representation.