calculation of size a memory in a correct place