If some of the function's arguments take references (directly or indirectly), then all of them are automatically added to the list of GC roots (addRoot()).
You still have a problem: you might have added an object passed as an argument to the GC roots, preventing the GC from collecting it, but if any thread is allowed to mutate a pointer inside this object pointing to some other data, using this other data in your thread is not safe, unless you have added a root for this other pointer too. You'd have to recursively add roots for this to work.
There's also the same issue with global variables, the ones which are pointers to other pointers.
-- Michel Fortin michel.for...@michelf.ca http://michelf.ca/