Fix class cache to solve a SEGV (#746)
Fix class cache to solve a SEGV (#746)

When marshaling using `Oj.object_dump`, it might cause a SEGV with GC.compact.
This patch will fix a SEGV.

Related to https://github.com/ohler55/oj/issues/745

## Test code
```ruby
require 'oj'

class Foo
end

def dump_and_load(obj)
  json = Oj.dump(obj, :indent => 2, :mode => :object)
  Oj.object_load(json);
end

1000.times do |i|
  obj = Foo.new()
  dump_and_load(obj)
  GC.verify_compaction_references(double_heap: true, toward: :empty)

  puts "#{Integer(`ps -o rss= -p #{Process.pid}`) / 1024.0} MB" if i % 100 == 0
end
```
Shopify/oj,Shopify/oj,ohler55/oj,ohler55/oj,ohler55/oj,Shopify/oj