question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reference type support

See original GitHub issue

Hi,

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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
neuecccommented, Jan 12, 2022

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.

0reactions
neuecccommented, Jan 12, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found