Describe how Go memory management works, including garbage collection behavior and common pitfalls.
Implement a simplified mark phase of Go's garbage collector. Given an object graph and a list of GC roots, return all object IDs reachable from those roots. Ignore roots and references that do not exist in objects, prevent infinite traversal through cycles, and return reachable IDs in sorted order.
Function signature: def reachable_objects(objects, roots):
objects is a dictionary mapping string IDs to lists of referenced string IDs. roots is a list of string IDs. Return a sorted list of reachable string IDs.
objectsdef reachable_objects(objects, roots):