[vtk-developers] vtkGPUInfo and large amounts of memory

Sean McBride sean at rogue-research.com
Sun Jul 6 22:26:53 EDT 2014


On Sat, 5 Jul 2014 15:06:57 -0400, David Cole said:

>If you need more than 2^32 bytes of memory, you likely need to build 
>VTK as 64-bit anyhow, in which case, vtkIdType defaults to a 64-bit 
>wide type, too... So is a change really necessary?
>
>Or..... you *can* build a 32-bit build of VTK, but explicitly set its 
>id type to be 64-bits anyway, even in the 32-bit build.
>
>I'm not sure I see the advantage of using size_t over vtkIdType, as 
>they both vary in size based on CMake/compiler settings.
>
>Can you elaborate on why you think it would be better to use size_t 
>instead of vtkIdType?

"The other David"™ said much of what I was thinking.  To answer more directly, I brought this up because I made this change the other day:

<http://review.source.kitware.com/15924>

and noticed the possibility of overflow.

It's doesn't actually affect me, so I don't really care.  :)  Just thought to fix it while nearby. What rubs me wrong, as David said, is that vtkIdType doesn't seem at all appropriate semantically, as there are no "id"s involved, just a size count, for which size_t seems the best type (as it's what sizeof() returns).

Changing the return value to mebibytes is a good idea too, but a worse API/ABI breakage than changing from one kind of integer to another, I think.

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada


More information about the vtk-developers mailing list