Delete unused variable’s memory in java

There is no direct and immediate way to free memory in java. You might try to persuade the garbage collector to take away some object using the well known:

Object obj = new Object();
// use obj
obj = null;
System.gc();

but there is no guarantee that this will actually free memory immediately.

While this applies to heap memory, stack allocated items can only be freed when the function returns.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)