Consistently allocate device and iface variables on the heap.