1. A method for monitoring a plurality of data units, comprising: based on the content of said plurality of said data units, retrieving a plurality of states and dependency relationships among said plurality of said states that correspond to a plurality of unwanted patterns from a hierarchical memory system, wherein said plurality of said states and said dependency relationships are placed in a plurality of memory types in said hierarchical memory system according to a frequency of accessing said plurality of said states, which is calculated by comparing a plurality of test data patterns with said plurality of said states in a sequence specified by said dependency relationships; and identifying a set of suspected data units by comparing said plurality of said data units with said plurality of said states in said sequence specified by said dependency relationships, wherein the content of said set of said suspected data units collectively matches any of said plurality of said unwanted patterns.