Iam using Lucene search and use sort functionality of lucene to sort on one of the fields return. To sort data, lucene internally creates FieldCache for sorting. This cache does not get cleared when search is done and results are returned to the page.and everytime I do search, it keeps on increasing memory size.
Could you please help me in clearing this field cache from memory once results are returned, so that memory size returned back to normal state.
thanks
There’s something amiss if the memory keeps increasing on successive searches, unless different sort fields are being used of course. Anyway, the cache can be cleared with FieldCache.DEFAULT.purgeAllCaches, but the docs warn against using it for cache maintenance.