I made some other tests in SED and VSC 2015.

If I remove draw_quad I can create as many bitmaps with bmap_create as I can create with bmap_createblack and bmap_blit.

If I also remove bmap_blit I can create thousands of bmap_createblack bitmaps. It seems that bmap_createblack writes into the same memory area every time.

It also seems that the sys_memory and d3d_texbmaps need to be added together. If d3d_texbmaps stays at 0 then sys_memory can rise up to 1.6 GB before the out of memory message appears.

If sys_memory + d3d_texbmaps are just before 1.6GB and sys_memory rises while d3d_texbmaps stays the same Error 1005 appears.

When sys_memory stays the same and d3d_texbmaps rises you'll get Error 2005.

The sum of both values need to stay under 1.6 GB.