Dump memory before encoding png in case of crashes.