I have a page that is refreshed on an ajax timer which contains several Chtml::Button objects. I am seeing steady memory growth at each refresh cycle. If I remove these, the memory growth stops. How are controls, such as these best refreshed without the memory leakage??
could you paste the codes which about using CHtml::button method?
It appears it is related to using a background bitmap for the button. The resource is never released. If I use a standard button html definition, the leak is no longer there. It also appears that CTreeView exhibits the same issue. I am tracking that down also.
The call I am using is:
echo CHtml::button($name, array(‘submit’ => array ‘tekmonitor/controlclick’,‘id’=>$commandStream),‘type’=>‘submit’,
‘class’=>‘control’,‘style’=>'left: '.$left.‘px’));
The replacement call:
echo ‘<button type=button class=control style="left:’ .$left. ‘px"onclick=tekmonitor/controlclick id="’ .$commandStream. ‘">’ .$name. ‘</button>’;
CSS class
.control
{
background: url("../images/unselectedbutton.gif") no-repeat center top;
color: white;
font-size: 12px;
font-weight: 500;
position: absolute;
white-space: normal;
/*left: 225px;*/
width:85px;
height:50px;
border:none;
}
You’re talking about a memory leak in PHP on the server or increased memory usage by the browser?
The browser
So maybe compare the HTML code produced by CHtml::button and yours that doesn’t increase the memory usage.