Mendix 4: When is a object garbage collected?

I have a simple test case. A datagrid filled by a microflow with NPO's. I added a button to the action bar that passes the NPO to the server and on the server I checked if the object is still alive (not garbage collected). Even when I wait for about 10 minutes and invoke the garbage collector manually the object is not garbage collected. So my question is: does Mendix and when does Mendix garbage collect (unreference) this case. How can the server possibly know if a NP object is still used in the client. I can imagine that NPOs are unreferenced when the session timed out (user logout) so they can be garbage collected but isn't that a memory risk?
1 answers

An object can be garbage collected if it can no longer be reached. If there was some way for you to even check if the object is still alive then the garbage collector would be flawed, as long as you can reach the object it should not be collected.

The garbage collector runs after every request, but an object like this shouldn't and won't be collected.

The only way to deliberately fool it is by keeping a reference to an object in some static variable or custom thread in a java action and not adding it to the java action rootset. This is all pretty advanced stuff and I wouldn't worry about it too much. If you ever have to do something like this you can read about what to do at