[squeak-dev] Setting Memory pointer for bitmap object.. is it possible without plugin?

David T. Lewis lewis at mail.msen.com
Thu Mar 30 17:16:43 UTC 2023


On Thu, Mar 30, 2023 at 09:47:12AM +0200, Marcel Taeumel via Squeak-dev wrote:
> Hi --
> 
> I would use SqueakFFI and through that interface a system library for memory shared between processes. Maybe through memory-mapped files or similar...
> 
> https://learn.microsoft.com/en-us/windows/win32/memory/sharing-files-and-memory [https://learn.microsoft.com/en-us/windows/win32/memory/sharing-files-and-memory]
> 
> https://learn.microsoft.com/en-us/windows/win32/memory/creating-named-shared-memory [https://learn.microsoft.com/en-us/windows/win32/memory/creating-named-shared-memory]
> 
> 
> Once you have your ExternalAddress for that shared memory region, you can start reading and writing bytes from multiple Squeak images. Watch out for synchronization/locking etc.
> 

Also, you will want to make sure that your object is pinned,
see Object>>pin. The reason is that the garbage collector will
otherwise move your object around in the object memory, which
would make the pointer invalid, hence VM crash when you later
read or write using that pointer.

Dave



> Best,
> Marcel
> Am 29.03.2023 21:11:28 schrieb LawsonEnglish <lenglish5 at cox.net>:
> I decided to do a strange, but potentially very nifty thing, and share memory between two or more squeak applications on the Mac, but I find I can???t even get started???
> 
> What I???d like to do is manually set the pointer for a Bitmap in Image A so that it points to the same shared memory as the BitMap in Image B (and C and D and???)
> and then display the Image Bitmap while B (C, etc) asynchronously draw into the same shared memory.
> The immediate usecase would be doing a multi-process Mandelbrot Set drawing app where the Image A is for display and menu selection while the remaining Images
> do the calculations and setting of pixels.
> Is this doable out-of-the-box in Squeak, or must I write a plugin first?
> If so, what do I need to do?
> 
> If I do need to write a plug-in, how do I do it. I???ve read on the wiki about the Surface Plugin, but not quite sure if that is what I need or not.
> 
> Thanks.
> 
> 
> L
> 

> 



More information about the Squeak-dev mailing list