Memory leak fix - Improving cache mechanism and also session on-heap storage