Do you mean it is due to port? please first dirable the port, and add a source with the same bandwidh, and check the memory requirement. If it is realy due to the port, since it has 3 objects: mode source, frequency domain monitor and expansion monitor, so you can first check how many frequency points for each of them:
for mode source, use 10 or fewer points;
for frequency domain monitor, use 20 points, as the bandwith is small;
mode expansion monitor can use 10 or 20 points.
What mesh accuracy you used? please first use mesh accuracy 2.
In addition, please refer to the online example and compare the settings.
If the grating is not curved, you can use symmetry-type BC. This is the plane out of the screen for your image.