The DataNode can have a single limit for memory usage which applies to both replicas cached via CCM and replicas on RAM disk.
See comments 1, 2 and 3 for discussion.
Integrate HDFS-6581 memory usage with HDFS-4949
Write to single replica in memory
Split TestLazyPersistFiles into multiple tests