| freeMemory |
() |
yoix.system |
| |
Returns the amount of free memory, in bytes, that is currently available.
The value changes, often significantly in either direction,
as your program runs and as Java's garbage collector,
which runs as a low-priority thread, kicks in.
| |
| Example: |
Here is a simple program,
import yoix.stdio.*;
import yoix.system.*;
import yoix.thread.*;
Object obj;
while (TRUE) {
obj = new Dictionary {
String dummy[100000];
};
obj = NULL; // Dictionary should now be collected
sleep(2);
gc();
runFinalization();
printf("memory=%d/%d\n", freeMemory(), totalMemory());
}
that can sometimes help detect memory related problems.
Most of the time the memory statistics that the program prints
stabilize, as they do in this example.
| | |
| Return: |
double
| | |
| See Also: |
gc,
runFinalization,
totalMemory
|
|
Yoix is a registered trademark of AT&T Inc.
|