1. Do you have any patterns that the VQL editor reports warnings for? These warnings find a lot of these cases that are problematic for memory usage.
2. If you don’t, you could try to use the QueryPerformanceTest implementation [1] to figure out which of the patterns have larger memory usage. If we know which pattern is problematic, it is usually easier to figure out what the issue is and
how it could be rewritten to be better.
I actually have 2 patterns find_portconnection_system and find_portconnection_process to match about 15 model objects. I think this causes memory problems when dealing with large models.
After reflection, I may eliminate some parameters but I will query them in the rule code:
I can replace the commented line
pattern find_portconnection_system (
system : SystemInstance,
processdestination : ComponentInstance,
threaddestination : ComponentInstance,
featuredestination : FeatureInstance,
// processsourceref : ComponentInstance,
// threadsourceref : ComponentInstance,
// processdestinationref : ComponentInstance,
// threaddestinationref : ComponentInstance,
) {
// find is_in_trace(aadl2aadlref, _, processsource, processsourceref);
// find is_in_trace(aadl2aadlref, _, processdestination, processdestinationref);
// find is_in_trace(aadl2aadlref, _, threadsource, threadsourceref);
// find is_in_trace(aadl2aadlref, _, threaddestination, threaddestinationref);
ComponentInstance.connectionInstance(system, portconnection);
ConnectionInstance.kind(portconnection, ::portConnection);
// ...
}
into queries in rule code portConnection2DataAccessatSystem
val processsourceref = engine.is_in_trace.getOneArbitraryMatch (aadl2aadl,null,processsource, null).get.aadlrefElement
val threadsourceref = engine.is_in_trace.getOneArbitraryMatch(aadl2aadl, null, threadsource, null).get.aadlrefElement
// ...
This may be applied for about twenty parameters.
Do you think this may improve the performances?