improve c backend memory setup