use alloc_ref rather than hand-allocating "struct ref"