Memory management and local GC?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Oct 31 19:44:21 UTC 2020


On Saturday, 31 October 2020 at 19:31:23 UTC, Ola Fosheim Grøstad 
wrote:
> for shared access as you would need to have a borrow-pointer to 
> keep it pinned in the "foreign" GC-pool. So it is up to the

The pinning has to be a @trusted operation though to prevent 
multiple threads to access the GC local object.

If you want to do everything in @safe code you could use the same 
"isolated" mechanisms to allow pinning in @safe code.

Borrowed pointers remain scope limited when other threads access 
them, since the pointer is tagged as borrowed the type system can 
ensure that it isn't retained.

Another option would be for the dictionary to allow access 
through a callback that scope-restricts the object.


More information about the Digitalmars-d mailing list