Even memory safe languages do not technically eliminate all memory issues but they significantly reduce the amount of code you need to audit for memory issues.
You have no magical way of removing all memory security issues but you can definitely reduce the chance of one occurring by picking one of those memory safe languages.
The less time you have to spend on checking every piece of code memory allocations the more time you can spend on checking business logic for logical errors.