Exploiting Language Abstraction to Optimize Memory Efficiency