Merge branch 'develop' of https://github.com/stan-dev/stan into develop
added apply_recover functional to autodiff to catch, recover memory, rethrow, fixing leak in #543
re-added memory recovery for gradient to fix issue with symplectic test
Merge pull request #548 from stan-dev/bugfix/issue-543-grad-functional-leak

Fixes #543. Bugfix/issue 543 grad functional leak