[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[S8ObjC] gc issues

SwikiCodeRobot @> #testS8ObjCGcIssues

"Functions will fail when the result of a previous function (or method) is passed into a function directly.
e.g., without holding on to the variable result.
This is a race condition between the V8 GC collector and S8ObjC to see who gets to the FFI bridge first."
| pool logFn |
pool := (ObjCClass classNamed: #NSAutoreleasePool in: #Foundation) newInstanceHandle.
logFn := S8ObjC value: #NSLog.
10000 timesRepeat: [:i|
	"self print: i."
	logFn value: (S8ObjC value: '')
].


"Same issue but after loading UIKit"
| pool |
pool := (ObjCClass classNamed: #NSAutoreleasePool in: #Foundation) newInstanceHandle.
ObjCClass classNamed: #UIActivity in: #UIKit.
10000 timesRepeat: [:i|
	self print: i.
	(S8ObjC value: '') value: #caseInsensitiveCompare value: (S8ObjC value: '   ')
].