Freeing mmapped memory
John-Mark Gurney
gurney_j at resnet.uoregon.edu
Mon Feb 6 14:58:37 PST 2006
Raaf wrote this message on Mon, Feb 06, 2006 at 22:54 +0100:
> Hi, i am working on a usb driver that allocates some memory when
> the device is opened using malloc.
>
> Now i want user processes to be able to access this memory using
> mmap and i want to free this memory when it is no longer needed.
>
> The problem is that there seems to be no way of knowing for my
> driver at what time the memory is no longer mapped in a process
> address space so that i can safely free this memory.
why not at close time? I would imagine that the device won't be closed
until all the mmap's that are backed by the device are unmapped.. it
shouldn't be hard to test... the mapping should hold a reference to
the device until it's munmapped..
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-hackers
mailing list