Comment 6 for bug 1255632

Revision history for this message
Aurelijus Rinkevicius (odysei) wrote :

Hi,

You are right about the optimization, loosing it is also not a victory. However, I have an option 3):

3) Why not to make the variables private in the whole class and then simply reset them inside CPPProcess::initProc(). They don't have to be static.

BTW, there is a problem with your 2) suggestion. The problem is that the static variables jump out of the object and will have a cross-talk in parallel calls, i.e., while declaring CPPProcess Model_1, Model_2; these two objects, Model_1 and Model_2 will see each other static variables as the statics are shared accross the same-type class and its derivatives (methods). Also, this is exactly where I have encountered the problem the first time and got surprised of this interference.

Option 3) would provide two benefits: (1) calling initProc() would reset a model, (2) there would be no interference (memory sharing) between the same-type class objects. Hope it makes sense.

Best regards,
Aurelijus