home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!decwrl!pa.dec.com!decprl!decprl!vanroy
- From: vanroy@prl.dec.com (Peter Van Roy)
- Subject: Two 'malloc' questions
- Message-ID: <1992Jul29.092517.25584@prl.dec.com>
- Keywords: malloc free
- Sender: news@prl.dec.com (USENET News System)
- Nntp-Posting-Host: prl332.prl.dec.com
- Organization: Digital Equipment Corporation - Paris Research Laboratory
- Date: Wed, 29 Jul 1992 09:25:17 GMT
- Lines: 43
-
- Here are two questions that I urgently need answers to:
-
- 1. Is there a public domain version of malloc+free that uses a fixed area
- of memory, which is given it upon initialization? It should not touch
- the Unix break, but stay within the fixed area. It should give an
- error if it is not possible to allocate a block in the area. The
- call to free should do its job, i.e. an infinite sequence of mallocs and
- frees of the same size should work.
-
- 2. Is it possible to initialize things so that file operations do not
- call malloc under Ultrix (on a DECstation)? I know there is a call
- f_prealloc under RISC/os (on a MIPS workstation) that does this. It does
- not exist under Ultrix as far as I know. Calling fopen under Ultrix does
- mallocs of various sizes: several 28 and 256 byte blocks, and seven (yes,
- count 'em!) 8192 byte blocks.
-
- These two questions are important for the correct operation of the Aquarius
- Prolog system under Ultrix. Aquarius Prolog does its own memory management.
- It has been ported to several machine/OS configurations.
-
- During execution of the backend of Aquarius Prolog under Ultrix, the file
- operations call malloc, which interferes with Aquarius' own memory management.
- This is how: Aquarius manipulates the Unix break itself (the top of the bss,
- i.e. available dynamically-allocated space) to get more space from Unix when
- needed (e.g. when garbage collection does not recover enough memory). Malloc
- allocates memory by getting more space from Unix starting at the break. In
- other words, if Aquarius ever increases the break, then its memory will
- overlap with what malloc has allocated before.
-
- Thanks much for any help!
-
- Peter
-
- ----------------------------------------------------------------
- Peter Van Roy
- Digital Equipment Corporation Net: vanroy@prl.dec.com
- Paris Research Laboratory Tel: [33] (1) 47 14 28 65
- 85, avenue Victor Hugo Fax: [33] (1) 47 14 28 99
- 92500 RUEIL MALMAISON CEDEX
- FRANCE
- ----------------------------------------------------------------
-
-
-