[font=Consolas,]this on OK, works, but then[/font]
[font=Consolas,]
[/font]
[font=Consolas,]new CActiveDataProvider($newModel,…) as I know executes findAll() and then each of Item class returned in findAll() list has all attached behaviors.[/font]
[font=Consolas,]
[/font]
[font=Consolas,]This makes memory leaks in php and a big memory usage.[/font]
[font=Consolas,]
[/font][font="Consolas, Lucida Console, monospace"][size=3]Anyone know the solution to disabling behaviors in my written way?[/size][/font][font="Consolas, Lucida Console, monospace"][size=3]
But I believe that you don’t have to worry about that.
Usually “memory leak” in PHP is, I think, something that we (application programmers) have no control at all. It’s something the developers of PHP language should be worried about. We can not make or avoid a memory leak intentionally.
Or maybe you are using the word "memory leak" differently.
I don’t think the attaching/detaching of the behaviors will considerably increase/decrease the memory usage of CActiveRecord (or CComponent in general). A behavior must be a little pointer (or something similar) in the object instance level, I guess.
I think a CActiveRecord instance should be already heavy and large without behaviors, so worrying about behaviors seems a little unreasonable to me.