home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!coombs!avalon
- From: avalon@coombs.anu.edu.au (Darren Reed)
- Newsgroups: comp.unix.programmer
- Subject: Re: allocating memory pages
- Date: 12 Dec 92 16:13:36 GMT
- Organization: Australian National University
- Lines: 24
- Message-ID: <avalon.724176816@coombs>
- References: <1ga7o0INNdts@sequoia.ccsd.uts.EDU.AU>
- NNTP-Posting-Host: 150.203.76.2
-
- M.Gream@uts.EDU.AU (Matthew Gream) writes:
-
-
- >Im writing an application for SunOS that uses a large pool of
- >buffers (128-256, each 4k) initiallised at the beginning of
- >execution and filled/pushed/pulled/moved around during execution,
- >I was wonder whether there would be any performance increase
- >on aligning each buffer to a page (and indeed they would constitute
- >one page each), if so, how is it done?
-
- Try valloc(2).
- How good this is will depend on whether Sun's libc will want to
- add to that for its own malloc support (tree structure).
- If you dont have to worry about portability, use sbrk(2) and write
- your own memory allocation/management routines.
-
- Whether you get any performance improvement will depend on how often
- buffers are going to be used, etc. If you allocate a lot at one stage
- and dont use them again for quite some time you could be lucky and
- have their pages swapped out without affecting anything else. Again,
- this will depend on what Sun's libc does when it uses a valloc or malloc
- call...just get Sun's source and have a look......
-
- darren
-