I always understood cached memory in Linux (as in free -m) as pages of memory that can be reused if they are needed again, or quickly freed if more memory is needed by new applications (I found this article to be helpful a few years ago).
It seems that both executables (e.g., a program like thunderbird) and data (e.g., the content of a log file) can be cached. In fact, I don't think there is a distinction between text and executable files on *nix.
I can see how it could work for data that does not change much (e.g., a text file), but how does it work for programs that are dynamic by nature? Surely, the cached memory cannot restore objects that were dynamically allocated? Is it only the bytecode (or instructions in the case of scripts) that is cached then?
EDIT 1
By cached memory, I mean the memory under the column "cached" when I run "free":
$ free -m
total used free shared buffers cached
Mem: 7985 6650 1334 0 150 3201
-/+ buffers/cache: 3298 4686
Swap: 13178 2 13176
EDIT 2
Thanks to ls-lrt who gave me the hint I was missing. As this response on SE clearly mentions (should have searched there first), "The cached memory is the disk cache used by the VFS". This means that for executables, only the instructions (bytecode, script lines, etc.) are represented under this column and it has nothing to do with things that are dynamically allocated. I was under the impression that entire pages of memory (including dynamically created objects) were "cached".
EDIT 3
Nice examples about using the disk cache.