Explain the difference between static and dynamic memory allocation in a real-time system and why we generally avoid the latter.