Calculate used memory size with available memory