cherry pick smallint commit 20bb11e22d "Allow faster release of unqueued buffers"
Removed the mix with queueing in Decode function,
it will come as a second commit...