Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document if storage of value should be pinned? #1

Closed
dzmitry-lahoda opened this issue Apr 19, 2019 · 3 comments
Closed

Document if storage of value should be pinned? #1

dzmitry-lahoda opened this issue Apr 19, 2019 · 3 comments

Comments

@dzmitry-lahoda
Copy link

dzmitry-lahoda commented Apr 19, 2019

public ByReference(ref T value)

To avoid GC change location and invalidate pointer. I guess.

@Berrysoft
Copy link
Owner

Sorry to reply so late... You're right, the value should be pinned, but the struct is designed for VB, which doesn't have the equivalent grammer to ref variables and ref fields in C#. Anyway, I'll add the warning to the document, thanks!

@dzmitry-lahoda
Copy link
Author

dzmitry-lahoda commented Apr 24, 2019

That code allows to store ref inside struct. May be usefull for ECS systems in gamedev. I.e. memory will not be ever reclaimed from lists but loop onto next frame.

@Berrysoft
Copy link
Owner

Good example! It seems that the usage of the struct is much more than I have thought.😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants