debug memory calculation