She didn’t keep everything locked up tight with her occlumency, rather, she used the skill to keep her thoughts organized and unscrambled. After the war, it was the only thing that kept her sane. She had begun to learn the skill during 5th year when Snape was teaching Harry. Though, she wasn’t particularly skilled at it. More often than not, Malfoy tended to escape his box.