Reference type support
See original GitHub issueHi,
Good job with this! It solves a real need for users out there.
Have you considered/planned to support reference types in NativeMemoryArray
?
Seeing this line makes me think so. https://github.com/Cysharp/NativeMemoryArray/blob/8a9eac144e518bf1073725e4a923c3e1989ae568/tests/NativeMemoryArray.Tests/NativeArrayTest.cs#L137
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Reference types - C# Reference
There are two kinds of types in C#: reference types and value types. Variables of reference types store references to their data (objects), ......
Read more >Value Type and Reference Type
Reference Type. Unlike value types, a reference type doesn't store its value directly. Instead, it stores the address where the value is being...
Read more >ReferenceType (Java Debug Interface )
The type of an object in a target VM. ReferenceType encompasses classes, interfaces, and array types as defined in The Java™ Language Specification...
Read more >A deep dive: Value and reference types in .Net
The built-in reference types supported by C# include: object, string, and dynamic. All fundamental data types, Boolean, Date, structs, ...
Read more >Value Types vs. Reference Types - Elements Docs
Value Types vs. Reference Types. All Elements languages and platforms divide the type system into two fundamentally different kind of types* *Value Types ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
POH, still data exsits in managed heap. If the NativeMemoryArray supports reference types, record the reference address in the NativeMemory area. We have to ensure that this reference address does not change and that it is not erased by GC since it is tracked.
Thanks for info.
In this case, I don’t think it would be useful.
If we want to support a large reference array, my first idea was to create a ChunkedArray. This would support sequential writes and
ReadOnlySequence<T>
reads.concept code: https://gist.github.com/neuecc/e6293b1d88244cf942753d6408b3e966
I decided not to brush up on this idea, as it doesn’t seem to be very useful.