Since it looks like you are faced with a device restriction that limits the total size of the Bitmap space that you can create (they are apparently created in video memory and not in shared program memory), one alternative is to replace a large object Bitmap used here with an open block of Windows memory, access to it for reading and writing using the PInvoking BitBlt API function.
Initially, creating a memory block is difficult, and you probably want to ask another question about what (GCHandle.Alloc can be used here to create a “pinned” object, which means that .NET cannot move this in memory, which is important here) . I know how to do this, but I'm not sure that I am doing it right, and I would prefer to get expert input.
After you have created a large block, you will iterate over your elements, display each in one small raster image, which you continue to reuse (using existing .NET code), and BitBlt in the appropriate place in your memory block.
After creating the entire cache, your rendering code should work the same way as before, with the difference that instead of copying from a large bitmap image to the BitBlt rendering surface from the cache block. The arguments for BitBlt are essentially the same as for DrawImage (destination, source, coordinates and sizes, etc.).
Since you are creating a cache from normal memory in this way instead of specialized video memory, I do not think that you will encounter the same problem. However, I would definitely get the block creation code working first, and check that it can create a sufficiently large block each time.
Update: in fact, the ideal approach would be to collect smaller blocks of memory, and not just one big one (as I thought it was a problem with the Bitmap approach), but that’s enough for you. I worked with CF applications that deal with objects of 5 and 10 MB, and this is not a huge problem anyway (although it can be a big problem when this piece is fixed - I do not know). BTW, OOME always surprised me in creating BitMap because I knew that bitmaps were much less memory available, like you - now I know why. Sorry, I thought it was easy to solve at first.