1. A method of protecting computer program source code, the method comprising: receiving a portion of computer program source code that accesses a set of memory locations in a heap memory structure, the portion comprising a set of references to the set memory locations; protecting the portion of the computer program source code by modifying the portion to include a set of protection functions, the set of protection functions comprising: a set of copy functions that each copies contents of a different one of the set of memory locations in the heap memory structure to an associated variable in a stack memory structure; a set of reference functions that removes and replaces each of a plurality of the references to the memory locations copied by the set of copy functions with new references to the variables in the stack memory structure that are associated with the copied memory locations; a reset function that, after completion of execution of the protected portion using the new references added by the set of reference functions, copies a current value stored in each variable in the stack memory structure that is associated with a copied memory location back to the associated copied memory location in the heap memory structure; and compiling the computer program source code after the portion has been protected.