Merge pull request #173 from billhollings/master

Device memory management changes.