🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.transputer
Article #1496

Re: how much memory left

#1496
From: Mitsunori Kawabe
Date: Wed, 13 Mar 1991 02:08
20 lines
1253 bytes
In article <9103111424.aa27802@sappho.ux.King.AC.UK> cs_s424@ux.kingston.ac.uk (Netherwood P J) writes:

 |Does anyone know of a method of determining how much memory you have
 |left after a series of calls to malloc in 3L's Parallel C ?

How about use undocumented global variable "IMP___HEAP_LIMIT".
It points top of heap. So you can estimate free memory left by subtracting
this value from current stack address like following.

int free_mem()
{
  extern char *IMP___HEAP_LIMIT;
  char tmp;
  return &tmp - IMP___HEAP_LIMIT;
}

--
$@@nJUK~FA!w!J3t!K0B@nEE5!@=:n=j(J $@8&5f=j(J $@8&5fBh#1%0%k!<%W(J  TEL (093)641-3111
						        FAX (093)631-8440
kawa@yesun.yelab.yaskawa.co.jp
Technical Details
Message-ID: <KAWA.91Mar13110817@yesun.yelab.yaskawa.co.jp>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!rutgers!sun-barr!ccut!wnoc-tyo-news!astemgw!kyu-cs!ye-gw!kawa
References: <9103111424.aa27802@sappho.ux.King.AC.UK>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!rutgers!sun-barr!ccut!wnoc-tyo-news!astemgw!kyu-cs!ye-gw!kawa
From: kawa@yesun.yelab.yaskawa.co.jp (Mitsunori Kawabe)
Newsgroups: comp.sys.transputer
Subject: Re: how much memory left
Message-ID: <KAWA.91Mar13110817@yesun.yelab.yaskawa.co.jp>
Date: 13 Mar 91 02:08:17 GMT
References: <9103111424.aa27802@sappho.ux.King.AC.UK>
Sender: news@ye-gw.yelab.yaskawa.co.jp
Organization: Yaskawa Electric Mfg. Co., Ltd.
Lines: 20
In-reply-to: cs_s424@ux.kingston.ac.uk's message of 11 Mar 91 14:24:49 GMT