I was wondering if there’s any recommendations on how to deal with structs that contain pointers. My situation is the following: I have an fairly large array (A) for a struct, within the struct I have a pointer to another array (B). Now multiple structs share the same pointer to a location within the other array.
What I currently do is that I copy B to the device and then adjust pointers for each and every struct to point to device memory and afterwards copy A to the device.
Now my questions is whether this really is the best approach to this? I don’t feel that this is a really good approach.
I also thought about just having all structs share a base pointer and then just give them an offset to point to the correct location in array B. However I wonder if there might be any problem between 32-bit and 64-bit addresses (currently using a 64-bit Linux)?
Any thoughts on this from the experts on this forum? :)
PS: I’ve been searching through the forums but I haven’t really found a satisfying answer.