Garbage collection of NPEs

I have been reading the docs about garbage collection and the handling of requests with NPE's ( We have been having some issues where our app would crash after a certain amount of time. I believe that it has to do with NPE not getting deleted because they are still referenced by a 'previous page in history’ after I leave the page and go to another. This causes the garbage collector to not throw these objects away. I tried closing all pages before going to another but that does not change anything. Is there a way to get this page out of the history of a session so it can be garbage collected as well? 
2 answers

I don’t think it will be good for your application, but an option might be to use a DS microflow rather then pass the entity as a Parameter. With a Datasource, that NPE is created each time again and I think it should be garbage collected directly after you leave the page and you do not have the page history issue.

If you can replicate the issue, it would at least tell you if this is the exact issue you are facing.


Would it be an idea to do a delete of the NP objects when opening the next page? I always try to use cascading delete so only a single delete is necessary. Obviously, there will have to be a DS on the page to repopulate any objects if necessary when flipping the page back (instead of having data being set in a NF that opens the page).