Non persistent entity and garbage collection ?

We have a dashboard like page based on a non persistent entity (NPE) which contains the relevant metrics that are shown on the page and in piecharts. A new NPE is created and metrics are calculated every time when the page is called. On the page a microflow timer is used to check every minute if there are changes, and if so a new NPE is created and the page is called again. In this way the dashboard page is automatically refreshed. Scheduled events change the system status at least every 15 minutes, so certainly every 15 minutes the page is refreshed (and hence a new NPE is created). Users tend to keep this page open in there web browser, as it give a good overview of the system. We noticed that after a certain time period the page is shown without content. The web browser console then indicates that there is no NPE for the dataview  “no object is available in context “and the microflow timer is no longer executed (As the NPE is input for the microflow called by the microflow timer).  Mendix log does not indicate any error. As there is no delete of the NPE in the code itself I suspect that the NPE is removed by the garbage collection. However, I can not find documentation on how and when this is done.  Is there a check when the NPE is last changed before it is removed by the garbage collection at the client. What is the time out for this ?  Is there another way to prevent that the NPE is removed during an active session of the client ? Or is there a way to close a page and go to the home page when this occurs ?  
3 answers

I believe that if you associate your NPE to the session it will never be garbage collected as long as the session is open.



I think Andrej is correct. Why do you need to create a new object. Can’t you just update the existing one?


Currently, an update each minute. Of course there is a big chance that this is good enough for you, but is this perhaps a nice use case for trying See The gain might be realtime data in contrast to the minute delay.