Speedup persistent data
Fix a memleak in torrentmodel.

Perhaps we should finally move to C++11 and std::unique_ptr?