Patent ID: 8108848

Claim:
A memoization system, comprising at least one processor and least one computer-readable storage medium storing instructions executable by the at least one processor to implement: an analysis component configured to perform analysis of program code; a memo component configured to memoize a function in response to the analysis at least in part via code injection; a storage component configured to provide functionality pertaining to storing and returning computed function results, and including a generation component configured generate a storage construct to store computed function results, in the form of a hash table accessible by at least one of a hash function or a key selector specified in code, a default function if no explicit hash function or key selector is specified in code, or a function inferred from contextual information; and a custom component configured to inject functionality in addition to code injected via the code injection, the functionality including functionality pertaining to creation or detection of cycles in a recursion, and functionality to insert a dummy value into the storage construct and a called function, scan a result of the called function for occurrences identical to the dummy value, and replace the occurrences with a back link to a root value of a recursive graph corresponding to the called function.