Replace SplObjectStorage with array.

SplObjectStorage did not free its memory correctly.