留言板

Improve use of memory in Liferay.

Iñaki Sainz,修改在14 年前。

Improve use of memory in Liferay.

Junior Member 帖子: 28 加入日期: 07-5-29 最近的帖子
There are an issue in the use of TagLib SearchContainer whose effect is excesive memory consumption because searchcontainer results is not nulled.

At doEndTag method of SearchContainerTag the _searchContainer variable is nulled in order to make it reachable by the garbage collector. But the variable also is refered by the SearchFormTag. This class never assigns a null value to the _searchContainer variable.

Tomcat has a feature to reuse the tags and improve overall performance. This feature consists in a tag library pooling system that causes any pointer isn't nulled. Because this behavior searchresults are live in memory for long time. If the search results are a long list of values then the memory int old generation will increase with objects with no use or mission. El total de la memoria que puede estar afectada por este fallo depende del volumen de búsquedas y del número de la lista de resultados, pero en mi entorno de producción se acerca a las 100Mb.

To fix this is necessary to null the reference to _searchContainer variable in doEndTag method at SearchFormTag class. Like this:

public int doEndTag() throws JspException {
_searchContainer = null;

return super.doEndTag();
}

LPS-8794