I just encountered a very weird discrepancy between the same "retrieve over assocation" in a pre-page microflow and an on-page datasource microflow. Does this show that these two types of retrieve call a different kind of cache? To clarify, I am never committing my 'Role' objects. Here are the steps I take: In a microflow, I retrieve a list of 'Role' over association and add new items to the list if specific roles are missing. As an effect, 1 extra role is added to the list and associated to the main object. At the end of the microflow, I open a pop-up. In the pop up, I call a DataSource microflow to retrieve the same list over the same association. I use 'find' to select a specific role. I close the pop up. I call the microflow of step 1 again. The same amount of Roles is retrieved as in step 1, so again the extra role is created and associated to the main object. Upon opening the pop up, the DataSource microflow is called again. This time, there is one role too many. Apparently, the role that was created in step 1, that was not retrieved in step 4, is now retrieved. If I do this again and again, more roles are retrieved in the DataSource microflow, but not in the pre-page microflow... I have replaced my 'Close page' by a 'Cancel' to fix the behaviour. However, still curious how this could happen!
The intended behavior of the Mendix is that things can either be retrieved from the database or the cache. There are only those two locations. The behavior you are seeing sounds like a potential platform bug. Mendix has done work recently to replace the business server cache with a client-side cache, so I recommend upgrading to the latest version and checking if the issue still exists. If so, I'd create a support ticket to let Mendix know about the potential memory management issue.
Yes, this seems like a bug. We've found many similar bugs related to cache in Mendix 7. For example when editing an object that's on a NewEdit page, through a grid with source database or Xpath. If you do not save or rollback and go back to the grid (for example by clicking on the link to the grid page in a menu), the edited info does show up. Even though that grid should retrieve everything from database and therefor not use the edited data in memory. It got even weirder when searching: it showed the edited data, but would only show this when you searched using the unedited data as criteria.
This particular issue was fixed in 7.13, but similar issues in various situations still occure now and then. The way the cache is used, is not always 100% correct.