I can't find much online on this but here is my thought, a language like rust analyses on compile when to free objects from memory. Why can't the same be done with Java then we don't need a garbage collector. Unless it's because this would make the coding even more complicated.
So the question being could the Java compiler manage memory before runtime