Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!prlvax1.prl.philips.co.uk!EDMONDS From: EDMONDS@prlvax1.prl.philips.co.uk (Mark from Philips) Newsgroups: comp.sys.transputer Subject: Dynamically determining memory size Message-ID: <900118090758.0000409D0C1@prlvax1.prl.philips.co.uk> Date: 18 Jan 90 09:07:58 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 24 You can determine memory size dynamically by using the variable 'freespace'. freespace gives you the total amount of memory left over after your program (and other programs, e.g. compiler on a host) has been loaded. Since occam has no dynamic features, freespace is a constant. You can even use it, e.g. as an array: VAL freesize IS freespace : []INT array IS [freespace FROM 0 FOR freesize] : However, you do need to know what other programs are currently loaded into memory and the size of their program and data spaces - but that shouldn't be too tricky to work out. In fact, you could even write a process (a memory manager) that allocates freespace to itself, and accepts requests from other processes for bits of it. That way, you can (sort of) have some sort of dynamic memory arrangement (procedural abstraction?). Mark Edmonds Philips Research Labs edmonds@uk.co.philips.prl