MartinW opened this issue on Oct 27, 2006 ยท 26 posts
diolma posted Fri, 27 October 2006 at 5:23 PM
LOL, Stewer! - You're right (with a couple of small exceptions..)
Exception 1. Poser's "Out of memory" error is (IIRC) the default error message given whenever some error occurs that the programmer hadn't counted on (Get a "Failure" return from a function? oops - no indication of what that means - better give an "out-of-memory" error...)
Exception 2. The malloc() / free() stuff works well as long as it is mainly stack-based (ie, on a last-in, first-out basis). But Poser tends to hang onto stuff that is no longer needed (for faster re-use, should it be asked for). Also, I am fully aware that the free() function will combine adjascent free areas. But it doesn't take too many large textures to be loaded/removed to get memory fragmentation - the memory is still there, but scattered around. And textures need contiguuous space.... so Poser ends up with no single area large enough to hold the texture...
The only way around the problem is to write a completely new memory-handling module that will not just garbage-collect, but de-fragment at the same time (which involves moving all the used stuff so that it is in one single area at the front, and all the unused stuff to the end - or vice-versa). And changing every reference within the entire data area to point to the new position of the moved data. Not a trivial task!. And that, alas, slows up response time......
But I expect you knew that anyway. I'm just showing off (again)...
Cheers anyway (about to run and hide under my bedclothes),
Diolma