Remove 300us per invocation due to GC overhead

Previously a handle was provided when borrowing a resource,
which required an object to be created on every borrow. This
adds significant memory pressure, resulting in more frequent
garbage collections.

The resources borrowed by a thread are now tracked in a thread
local. Internally some clean-up is still required to remove the
handle completely.