getMemoryUsage
int sutil.getMemoryUsage ( ) (enterprise edition only)
Description
Get memory usage of screen-scraper.
Parameters
This method does not receive any parameters.
Return Values
Returns the average percentage of memory used by screen-scraper over the past 30 seconds, as an integer.
Change Log
Version | Description |
---|---|
5.0 | Moved from session to sutil. |
4.5 | Available for enterprise edition. |
For tips on optimizing screen-scraper's memory usage so that it can run faster, see our FAQ on optimization.
Examples
Stop Scrape on Memory Leak
// Stop scrape if memory is low
if( sutil.getMemoryUsage() > 98 )
{
session.log( "Memory is critically low. Stopping the scraping session." );
session.stopScraping();
}
if( sutil.getMemoryUsage() > 98 )
{
session.log( "Memory is critically low. Stopping the scraping session." );
session.stopScraping();
}
scraper on 07/16/2010 at 5:02 pm
- Printer-friendly version
- Login or register to post comments