Fixing memory leak issue exposed by SHARK-116

The fix for major memory leak as discussed in https://groups.google.com/forum/#!topic/shark-users/XT1CexIuAKk
The idea to is provide a way for Shark users get around until more fundamental solution comes around in 0.8 release.

I have ran patched version of Spark cluster with Shark client for a few hours constantly running different queries and can see that GC manages to clean up everything properly on every cycle; hence the issue with KryoSerialization as a ThreadLocal seems to be addressed.