SAP CRM WebClient UI的内存清理策略分析

If we searched 5 PPR and go to Account and then go to PPR again, search results are still there.

SAP CRM WebClient UI的内存清理策略分析_第1张图片

Why are the two navigation causing different behavior?

Some key points we must remember:

Every time you navigate away from current view, WD_DESTROY will be called, either the child’s own redefined one or default implementation of parent.

SAP CRM WebClient UI的内存清理策略分析_第2张图片

DESTROY method of context node class will be called one by one.

SAP CRM WebClient UI的内存清理策略分析_第3张图片

SAP CRM WebClient UI的内存清理策略分析_第4张图片

In PPR case, since RESULT node in view controller is mapped to RESULT in component controller via context binding, so collection wrapper will not be cleared.

SAP CRM WebClient UI的内存清理策略分析_第5张图片

Instead it will just clear the context node reference itself.

Let’s record down the real BOL collection in collection wrapper before CLEAR me->typed_context.

SAP CRM WebClient UI的内存清理策略分析_第6张图片

{O:1253*\CLASS=CL_CRM_BOL_ENTITY_COL}

After clear is executed, we check {O:1253*\CLASS=CL_CRM_BOL_ENTITY_COL} in debugger:
The 5 PPR BOL entities are still there:

SAP CRM WebClient UI的内存清理策略分析_第7张图片

That means WD_DESTORY will only clear context node reference itself, but not the real BOL content in BOL wrapper.

The BOL content will only be cleared when:

When navigation is being executed, framework event will be raised:

SAP CRM WebClient UI的内存清理策略分析_第8张图片

SAP CRM WebClient UI的内存清理策略分析_第9张图片

CL_CRM_UI_SESSION_RESTART works as event handler and will clear bol buffer by evaluating flag gv_bol_reset_requested.

SAP CRM WebClient UI的内存清理策略分析_第10张图片

In lv_bolcore_reset the 5 PPR entities will be deleted in BOL container.

SAP CRM WebClient UI的内存清理策略分析_第11张图片

So now question is when is gv_bol_reset_requested set?

For example if you click “Home”,

SAP CRM WebClient UI的内存清理策略分析_第12张图片

Framework will evaluate if the navigation target is a Workcenter.

SAP CRM WebClient UI的内存清理策略分析_第13张图片

If so, the framework event before_context_change will be raised.

SAP CRM WebClient UI的内存清理策略分析_第14张图片

The event handler for it will simply set restart_requested flag to ‘X’.

SAP CRM WebClient UI的内存清理策略分析_第15张图片

Later this flag will be evaluated and set gv_bol_reset_requested.

SAP CRM WebClient UI的内存清理策略分析_第16张图片

If you just click a work center view for example “Accounts”, line 91 will not be executed and thus gv_bol_reset_requested will always equal to abap_false.

SAP CRM WebClient UI的内存清理策略分析_第17张图片

要获取更多Jerry的原创文章,请关注公众号"汪子熙":


SAP CRM WebClient UI的内存清理策略分析_第18张图片

你可能感兴趣的:(SAP CRM WebClient UI的内存清理策略分析)