Hi to all!
A bit of commented code should be enough to explain my problem:
Point by point, please correct me where I'm wrong!
A: valueArray allocates 100 floats. refArray is just a pointer to valueArray.
B: this is confirmed here: changes in valueArray can be accessed through refArray.
C: Here's where I don't get it. valueArray allocates at a new adress, and ref array still points to the old one. Will the memory get garbage collected if refArray is local? Or will it cause a leak?
Many thanks for your insights!
It will get garbage collected when the system is ready to collect again, that will happen at any time after the last reference to refArray. You will not leak memory that way.
answered Jul 31 '12 at 06:31 PM