The problem you are facing on termux is an issue in android phone where by termux will be killed by android whenever it tries to consume more memory . Any heavy background process that consumes battery and memories will be terminated by android.
I am sorry in order to fix it you will need :
- Computer
- USB cord
- And some run some adbs on your computer.
This are the code that you will run after downloading adb from here
You will need to connect your Android phone to your computer and enable USB debugging.
Follow this tutorial to solve it, it does not require much skills . Run the codes as it described.
You can join GitHub community to know more .
adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent”
adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647”
adb shell settings put global settings_enable_monitor_phantom_procs false
This codes has been described here to fix the termux error you are facing.