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 first code for 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 second code for 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 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 set of first code corresponding to the identified set of second code; and removing, by the computer and from the intermediate representation, the identified set of first code and the identified set of second code.