add delegate to autorelease instead of managing manually
#OC-10743 fixed
#OC-10723 fixed

(cherry picked from commit bcea41ffa26ef625c42ac3b918d4b42daabf2216)
cleanup

(cherry picked from commit 97917bba5f40b2686733719fc490f85082e8c2be)
remove delegate instead of adding to autorelease pool

(cherry picked from commit 8e3568bd8831a6fdb26ef967c81e020708f6262a)