First post, by Rav
himem.sys
You want to allocate a specified amount of XMS but you only test if the returned handle is 0 (because you think that if himem return handle = 0, then it know it can't allocate it and so it don't allocate it.... right?!?)
Well, If himem don't see a contiguous chunk of XMS available, it does return 0 for handle then you just think you just have to test that to know and terminate properly.
However If the thing don't have a contiguous block that fit and you have in reality more than 32MB available, somehow, it allocate 100% of the XMS instead of the specified amount, and it return 0 for handle, so you can't use it nor unallocate it then exit with no more free ram (total memory leak)!
And the worst is that you use himem alone, without emm386 nor any himem replacement, like 386max or qemm) AND you have > 32MB available, then that mode seam to be the default one 😂 (Only way to actually allocate it is to check the size of the biggest available block then allocate it (loop if you need to allocate more and keep track of many handles).
If you fill like half of the XMS using something like xhdd.sys, then it fix the himem problem.
Just running with himem+EMM386 or QEMM instead also work but you endup in V86.
Could it be the reason why some programs fail when you have more than 32MB available?
Is there a better XMS manager that work well without being in virtual mode?