In general, the invention is directed towards techniques for adaptively
prioritizing cardiac episode data in a memory of an implanted medical
device (IMD). More specifically, the IMD receives new cardiac episode
data, assigns each piece of data a priority value, and stores the data in
a memory of the IMD. The IMD can further recalculate initial priority
values assigned to stored cardiac episode data in response to subsequent
cardiac episode data. In this manner, the prioritization scheme used by
the IMD is adaptive, i.e., changes as more contextual information
regarding the cardiac episode and subsequent cardiac episodes becomes
available. Upon exceeding a memory capacity threshold, the IMD identifies
the stored cardiac episode data with a lowest priority from the
hierarchical priority relationship, and overwrites the identified portion
of the stored cardiac episode data with the new cardiac episode data.