-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failuresarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triagedIssue has been triaged by sub teamIssue has been triaged by sub team
Description
This opens up the possibility to share arbitrary objects.
Example:
import 'package:dart_internal/isolate_group.dart' show IsolateGroup;
import 'dart:isolate';
@pragma('vm:shared')
List<String> Function()? getList;
void main(List<String> args) {
final list = <String>[];
getList = () => list;
void func() {
final list = getList!();
for (int i = 0; i < 1000; i++) {
list.add('abc$i');
list.removeLast();
}
};
for (int i = 0; i < 20; ++i) {
Isolate.run(() {
IsolateGroup.runSync(func);
});
}
}dart --experimental-shared-data foo.dart
===== CRASH =====
si_signo=Segmentation fault(11), si_code=SEGV_ACCERR(2), si_addr=0x7fe1c378adf0
version=3.11.0-edge (main) (Unknown timestamp) on "linux_x64"
pid=1594953, thread=1594966, isolate_group=main(0x557d32857970), isolate=(nil)((nil))
os=linux, arch=x64, comp=no, sim=no
dart --experimental-shared-data foo.dart
Unhandled exception:
type 'Null' is not a subtype of type 'String' in type cast
#0 List.length= (dart:core-patch/growable_array.dart:236:12)
#1 List.removeLast (dart:core-patch/growable_array.dart:346:10)
#2 main.func
dart --experimental-shared-data foo.dart
Unhandled exception:
RangeError (index): Invalid value: Not in inclusive range 0..19: 21
#0 List._setIndexed (dart:core-patch/growable_array.dart:281:49)
#1 List.[]= (dart:core-patch/growable_array.dart:276:5)
#2 List.add (dart:core-patch/growable_array.dart:291:9)
#3 main.func
/cc @aam
Metadata
Metadata
Assignees
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failuresarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triagedIssue has been triaged by sub teamIssue has been triaged by sub team
Type
Projects
Status
No status