Optimizing cache performance through improving data locality has been receiving a lot of attention. However, none of the existing approaches can combine each task's behavior to optimize data locality for caches. We present a behavior aware data locality (BADL) to optimize cache performance in this paper. The key idea is to add each task's behavior when allocating memory, which can take advantage of each task's different locality to optimize cache performance. There are five main contributions: 1. to our best knowledge, this is the first attempt to improve cache performance through combining task behavior; 2. BADL detailed analyzes low performance derived from internal of the cache line, which is more finegrained than the current state-of-the-art fine-grained in hardware angle; 3. BADL optimizes the cache performance through improving internal of cache line efficiency; 4. we implement BADL both in single-threaded application and multi-threaded applications scenarios; 5. BADL can be combined to most of the cache optimizing researches. The experiment results show our proposed BADL can improve 18.6% performance on average in single-threaded application situation and improve 20.8% performance on average in multithreaded application situation.