Garbage collection reclaims memory from unused objects, but it doesn't prevent out-of-memory errors. If you create objects faster than GC can collect them, or if you have memory leaks (unintentional object references), the program can still exhaust available heap space. GC is a management tool, not a memory guarantee.