a2 / MessagePack.swift

It's like JSON, but fast and small…and Swift! – msgpack.org[Swift]
http://msgpack.org
MIT License
283 stars 60 forks source link

Fix memory consumption during unpack #38

Closed BrettThePark closed 8 years ago

BrettThePark commented 8 years ago

removeFirst causes a data copy which can very quickly grow memory since this method may be called hundreds of thousands of times. I can escalate my machine to many GB of memory in a couple seconds when unpacking large arrays.

The fix uses a subdata call to avoid the copy issue.