Ram search is simply, but
for megadrive maybe the best option is using Retroarch.
(With snes, zsnes, snes9x, etc works fine)
You have to discard incorrect codes.
There is 3,000,000 codes.
Cheat searcher 8 bit, value 2 (because you see 2 lives on screen)
There is 50 codes now.
(All codes != 2 dissapeared)
Doing this sometimes left a few codes and one of them can be Infinite Lives.
The other way is, unknow initial code.
You have to use:
Value is bigger now,
Equal, Not Equal.
It takes more time.
Btw I have no idea about trace ram codes to the rom offset.