maintain parent-child relations of ffi objects

This should prevent GC collecting parent objects until we are done
with their children.

Signed-off-by: Jan Dvořák <mordae@anilinux.org>