A memory leak may occur when:(1 point)Responsesa heap gets too large.a heap gets too large.a heap gets too small.a heap gets too small.a stack gets too large.a stack gets too large.a stack gets too small.

1 answer

A memory leak primarily occurs when a program allocates memory (typically on the heap) but fails to release it after it's no longer needed. This means that the correct answer related to memory leaks is:

a heap gets too large.

In contrast, a stack getting too large would lead to a stack overflow, not a memory leak. A stack getting too small is not typically relevant in this context.