Date: Thu, 19 Nov 2009 06:32:26 -0800 From: Julian Elischer <julian@elischer.org> To: Sharad Chandra <sharadc@in.niksun.com> Cc: Kostik Belousov <kostikbel@gmail.com>, freebsd-hackers@freebsd.org, Robert Watson <rwatson@freebsd.org>, Jung-uk Kim <jkim@freebsd.org>, Manprit Singh <manprits@in.niksun.com> Subject: Re: mprotect(2) clears the flag for whole page which causes program crash. Message-ID: <4B0556FA.1080709@elischer.org> In-Reply-To: <200911191627.34076.sharadc@in.niksun.com> References: <200911171529.20098.sharadc@in.niksun.com> <alpine.BSF.2.00.0911181849460.12162@fledge.watson.org> <200911181433.52557.jkim@FreeBSD.org> <200911191627.34076.sharadc@in.niksun.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Sharad Chandra wrote: > ,---- [Jung-uk Kim wrote:] > | On Wednesday 18 November 2009 01:52 pm, Robert Watson wrote: > | > On Tue, 17 Nov 2009, Sharad Chandra wrote: > | > > Is it known bug or is there any workaround? How will a userland > | > > process make sure that process will not crash as malloc(3) can > | > > allocate where ever it get the memory free to use. > | > > | > mprotect(2) operates on pages, so you'll want to use mmap(2) and > | > munmap(2) to allocate and free pages directly rather than > | > mallac(3), which manages byte ranges from pages managed using those > | > same interfaces. > | > | For example: > | > | http://docs.freebsd.org/cgi/mid.cgi?200911181926.nAIJQHOR081471 > | > > Thanks everyone. mmap(2) worked and program did not crash. Only problem with > it I use only fraction of allocated memory (each request alocate minimum of > one page and my request is in hundreds), rest is waste of it so no one else > will get this memory to use. And if a process runs as daemon and makes many > request, It can hold a lot of it. Just a question floated in mind. write your own allocator that efficiently divides up the mmapped pages among several requests? > > Many thanks, > Sharad Chandra > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B0556FA.1080709>