Forums › TWAIN Classic › Bad allocation of memory by source? › Re: Re: Bad allocation of memory by source?
Noone could absolutely verify your theory is correct without having the same hardware and checking for themselves, but it does sound like you’re on the right track. When working on any software that deals with hardware, it always makes sense to check things on more than one device. It can help you narrow things down considerably.
Having said that, I’ll just mention that there are other issues that can cause problems such as you’re describing, although the fact that this doesn’t happen with all vendors does make it unlikely you’re running into any of them.
1 – It’s important that memory is allocated and deallocated using the same heap architecture, so it’s important that everyone involved in getting an image from a TWAIN device to an application use the GlobalFree and GlobalAlloc functions.
2 – The other main thing to ensure is that both the allocator and the freer use the same structure alignment during compile time. The TWAIN header files already have the appropriate compiler directives to ensure this, but if someone were to recreate those definitions for a new language, they might run into problems if they don’t pay attention to the alignment.