Sharing memory between BlitzMax processes?

BlitzMax Forums/BlitzMax Programming/Sharing memory between BlitzMax processes?

@Pantheon

Hello,

Nothing really special about BMax and this code should cause a problem. I suspect if you dont call the close method and ensure you Free the Shared memory you will run into problems.

You need to make sure that if the Application Terminates the Close Method has been called as that would leak API resources.

My demo was really simple example, but I would use a Global Var for the Shared Memory section and write an Onexit handler to ensure that the close method is invoked. If you just call "END" in BMAX you will have problems.

The one nuanices of these types of resources is they are avaialbe across processes so you need to be real sure your application cleans them up.


Now your code might be faulting due to both procesess accessing the Shareed memory at the same time. For that it really needs a real OS MUTEX/CRITICAL Section to ensure only one process is accessing the Shared memroy at that same time.

My example was trivally stupid and just to show it can be done. Its not really a full blown piece of code just the bare minimum.

If you want to share your code, Ill take a look at it and see if I can see what might cause your problem. I suspect it needs OS Mutex.

Doug Stastny