Hi Sahil,
This is unlikely to be a memory issue.
It is much more likely to be something related to the records or what you are doing in the if/else blocks.
Are you changing the changing the MBOSet in a significant way e.g. deleting MBOs or changing MBOs that you were expecting to work through?
Are you triggering any other code (e.g. automation script/Java) that could be changing the records you would expect to see in the set?
Could any of the records be child records and so be being affected by operations on an earlier MBO?
Have you looked at the data in record 4 to see why it may not be listed?
Have you looked at the SystemOut/SystemErr.logs to see if there are any error messages in there?
There are unlikely to be any but it is always worth a check.
best regards,
Mark
------------------------------
Mark Robbins
Support Lead/Technical Design Authority / IBM Champion 2017 & 2018 & 2019 & 2020
Vetasi Limited
https://www.linkedin.com/pulse/maximo-support-advice-from-non-ibm-engineer-article-mark-robbins/------------------------------