1. A method comprising: generating, at a computer in a computer system, an intermediate representation of a script code, the intermediate representation being a form of the script code which is configured to be converted to an executable code for execution of the script code, the generating the intermediate representation including: generating, for an object allocated in a memory of the computer, a set of first code, at least some of the set of first 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, and generating a set of second code, at least some of the set of second code decrementing the reference count of the object when a reference of the programming construct referring to the object is removed; identifying, by the computer and in the intermediate representation, a second code of the set of second code which, upon execution, does not decrement the reference count of the object to a zero value; identifying, by the computer and in the intermediate representation, a first code of the set of first code corresponding to the second code, the identifying including: identifying at least one of the set of first code that is associated with a variable on which the second code is operating, confirming that the variable is not modified by other code, and identifying the at least one of the set of first code as the first code; and removing, by the computer and from the intermediate representation, the first code and the second code.