When your WordPress code requires more memory than the default allocated memory, you get to see this error such as
Internal Error 500 or
Allowed memory size of … bytes exhausted (tried to allocate … bytes) in /… on line …
By default, WordPress automatically tries to increase PHP memory limit if it is less than 64MB. However, 64MB is often not high enough.
Increase PHP Memory Limit in WordPress
First you need to edit the wp-config.php file on your WordPress site. It is located in your WordPress site’s root folder, and you will need to use an FTP client or file manager in your web hosting control panel.
Next, you need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’
WP_MEMORY_LIMIT increases the default memory for front-end and back-end operations.
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
This way you don’t allocate too much memory to frontend operations that could end up affecting performance
This should solve the issue you're having. Remember, this can happen to any themes or plugin out there. It also depends on your hosting.