Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!linac!att!cbnewsh!rkl From: rkl@cbnewsh.att.com (kevin.laux) Newsgroups: comp.os.msdos.programmer Subject: Re: Available dynamic memory in MSC 6.0 Message-ID: <1991Mar25.143624.24690@cbnewsh.att.com> Date: 25 Mar 91 14:36:24 GMT References: <1991Mar25.095017.9802@cs.umu.se> Organization: AT&T Bell Laboratories Lines: 20 In article <1991Mar25.095017.9802@cs.umu.se>, erikt@ume.cs.umu.se (Erik T{rnvik) writes: > I'm using Microsoft C 6.0 in a major project. During execution I need to know > how much (dynamic) memory is available for allocation. There are some functions > (_maxavail() and _memavail()) that only seems to work in small models, > but since we use large model, I cannot use those functions. > > Right now I'm using the obvious but stupid method, I allocate and allocate > until I hit the roof, and then I free the memory again. Not nice, > but it works. Call Int 21h Function 48h (allocate memory) with BX set to FFFFh. This call will fail because you're asking for a megabyte of memory. *But*, it will return the size of the largest block available in BX. The value returned in BX is in paragraphs (16 bytes). -- ________________________________________________________________________________ R. Kevin Laux Email: rkl1@hound.att.com AT&T Bell Labs Voice: (908) 949-1160 Holmdel, NJ 07733 Fax: (908) 949-0959