Any android app is limited by the amount of memory it can use. Creating very big files can reach this limit and cause an "Insufficient memory" error.
- Choose a different sharing method - HTML is a very sufficient format that can hold many messages in one file. If that also does not work, try to use the photos option - this will take time to generate but most likely will not cause an error
- Split to multiple files - In the "sharing method" dialog, next to the desired method, click on the settings icon. In the setting you will find a way to limit, either the height of the file (photos) or the number of messages per file (PDF or HTML)