Am Dienstag, 19. Juni 2007 14:05 schrieb H. Verbeet:
On 19/06/07, Stefan Dösinger stefandoesinger@gmx.at wrote:
Yeah, HeapReAlloc works on object->decls with 0 bytes allocated, but not on a NULL pointer. It keeps the array growing simpler. I can just use HeapReAlloc unconditionally instead of something like this
Well yes, but why not simply start with a >0 size?
The idea is to avoid allocating unneeded memory as long as we don't know if the app is going to use fvfs at all. D3D8 can be used without setting any fvf, so I don't want to allocate more memory than needed for a feature that isn't necessarily used.
Obviously there is a little memory requirement for the heap management structures that belong to a 0 byte allocation. But extra code to check if This->decls is NULL + a HeapAlloc call need a few bytes too...
I can change that to allocate one or two start entries, but I personally think that 0 bytes are good to start with here.