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 configured to be converted to an executable code for execution, 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; replacing the second code with a third code, the third code decrementing the reference count of the object when a reference of the programming construct referring to the object is removed, the third code indicative of a non-zero value yielding function; identifying, by the computer and in the intermediate representation, a first code of the set of first code corresponding to the third code; and removing, by the computer and from the intermediate representation, the first code and the third code.