add in memory handling for gamma based rl decoder