On Fri, 6 Jun 2025 11:57:09 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
> > If it helps at this point, we did an initial prototype in the sandbox: > > https://github.com/openjdk/jfx-sandbox/tree/Marlin_FFM with several commits > > and reverts, so might need to go through them. > > Thanks. I took a look at it, and one of the things you did could be good for > a follow-up: you use a memory layout that allows accessing data in a more > structured manner than as a raw array of bytes or ints. For the initial > conversion, I wanted to make minimal changes to the callers of OffHeapMemory, > keeping the logic identical. This way everything about the implementation of > OffHeap memory is encapsulated in the OffHeapMemory class. > > > What @bourgesl and I weren't sure about was which `Arena` to use. I thought > > `Confined` was more suitable than `Shared` because there's no multithreaded > > access. > > I wondered about that as well. I changed it to `ofConfined()` and don't see > any problems so far. I'll run a full set of CI tests and if there are no > problems, leave it at that. Multi-threaded access in the sense of the not being used concurrently by different threads ? What FFM means is that the thread that creates the Arena is the only thread ever allowed to use the Arena or any memory allocated by it. I don't quite see how you guarantee a static field of a class is never accessed by another thread. And all it takes is for some other thread to have initialize the class and boom And how in fact is Marlin ensuring only one thread is ever used to run Marlin ? I didn't think it did anything of the kind. Is this just a case of the FX thread always runs it ? ------------- PR Comment: https://git.openjdk.org/jfx/pull/1814#issuecomment-2956888833