Java garbage collector runs with priority 1, due to which it is not guaranteed that System.gc() will actually execute if called.
Is there any way to change its prio
When a thread is created it inherits the priority of the thread that created it. The priority of a thread can be adjusted by using
public final void setPriority(int newPriority)
The problem is a thread doesn't "run" the garbage collector. The garbage collector is run by the VM (when Java wants or is in "good mood .. :)" ).
EDIT: The GC is not a thread but a method of the Runtime thread. You can change the priority of the Runtime thread but this will have no effect on the GC. The thread that calls the GC is a thread of the VM and is out side the scope of the API so you can't change its priority.
So, I don't really think you can set its priority.