PHP Fatal Error occurs when running setup:di:compile

i am getting an error when im running setup:di:compile

please refer to this image for more info

im using

ubuntu 19.04 (php7.2)

The setup:di:compile can sometimes fail when PHP hangs due to insufficient memory_limit. Refer to the Chapter 5 > Update memory_limit in How to install Magento 2.3 and build a web server on how to check and increase the value.

If that doesn’t help, then you’ll need to tell us what version of Magento 2 you’re running in order to try and narrow down the issue further.

Also, I notice that you’re using “sudo”. This prefix is not required to run a bin/magento command. If you can’t run this command without prefixing “sudo” then it’s an indicator that your Permissions, Groups or Ownerships are not configured to correctly as per the Official Magento Requirements. This will lead to more issues in the future. Consider following this post to address it: How to diagnose and fix Ownerships and Permission issues.