Need help with modifying Wine memory allocation in NTDLL

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
temperror
Newbie
Newbie
Posts: 2
Joined: Tue Oct 25, 2011 2:28 pm

Need help with modifying Wine memory allocation in NTDLL

Post by temperror »

Greetings!

We are building a project in which we need Wine to allocate its memory in a shared memory that would be accessible to our custom sub-processes.

We use Wine to run Unity3D. So far so good. Now, the idea is to run 3 independent sub-processes, each with its own graphical context (one per GPU on a 3 GPU machine), which would need to have access to client-side buffers (indices, normals, vertices, etc.). So, in order to do just that, when Unity demands to create such buffers, we want Wine to create these for Unity in shared memory, and then pass the shared memory pointers to the sub processes.

We have explored the map_view and wine_mmap_enum_reserved_areas functions, where memory is allocated. But before we break anything, we'd like to know if there's a recommended, or best, way to do this.


Thanks so much in advance!
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Need help with modifying Wine memory allocation in NTDLL

Post by vitamin »

temperror wrote:We are building a project in which we need Wine to allocate its memory in a shared memory that would be accessible to our custom sub-processes.
So why do you need to modify Wine? If you running all processes withing one instance of Wine you can use standard Windows techniques to create shared memory. Nothing special here.
temperror
Newbie
Newbie
Posts: 2
Joined: Tue Oct 25, 2011 2:28 pm

Post by temperror »

Well it's a little more complicated than that, because the Windows application is Unity, and we have no control over the way Unity asks for its memory to be allocated. We don't have access to Unity's source code either, so we can't modify it. The only thing we can do is recognize when memory is demanded by Unity to Wine, and then make sure it is shared memory that's allocated.

Any tips?

Thanks
Frédéric Delanoy

Need help with modifying Wine memory allocation in NTDLL

Post by Frédéric Delanoy »

On Thu, Oct 27, 2011 at 17:38, temperror <[email protected]> wrote:
Well it's a little more complicated than that, because the Windows application is Unity, and we have no control over the way Unity asks for its memory to be allocated. We don't have access to Unity's source code either, so we can't modify it. The only thing we can do is recognize when memory is demanded by Unity to Wine, and then make sure it is shared memory that's allocated.

Any tips?

Thanks
You'd better ask this on wine-devel mailing list
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

temperror wrote:The only thing we can do is recognize when memory is demanded by Unity to Wine, and then make sure it is shared memory that's allocated.
Good luck with that.

Most applications will be allocating/freeing lots of memory all the time. And most of it will be from default application's heap. This can't really be shared, or you risking breaking everything inside Wine. This memory used be everything, not just your application.

The only remote chance if your app virtual allocks some big section for internal use.
User avatar
DanKegel
Moderator
Moderator
Posts: 1164
Joined: Wed May 14, 2008 11:44 am

Post by DanKegel »

Maybe it would help to take a step back.
Why do you want to use three GPUs?
And -- if you were doing it on Microsoft Windows, how would you do
what you're looking to do? Maybe we can get Wine to do the same thing.
Locked