Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Brett Porter Date: Fri, 19 Sep 1997 15:01:21 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Where is my physical memory hiding? CC: djgpp AT delorie DOT com Precedence: bulk Brett Porter wrote: > To start off with, I have 8Mb Physical RAM and run on a multi-config Windows [snip] > using RHIDE... it is in the go32_mem_info block section). This reports to me > that I have over 7000000 bytes free (it changes each time I run it, > depending on various things). > > But when I try to allocate 62 blocks (each 64000 bytes), I run out of memory. > Shouldn't there be enough, and if not, shouldn't it start paging to disk? I > have 19Mb free on my Hd... At first you are asking for: 62*65536=4063232 bytes, so 7Mb is enough. Sounds strange, what DPMI host are you using?, are you sure is 64000 bytes or perhaps you are allocating 0x10000? Second: as you said you have: 8Mb-2Mb(cache)-1Mb(base memory)-4Mb(if you are using RHIDE when you run the program)= 1Mb of real memory ;-))), don't spect that the DPMI host will use ALL the available disk. In particular CWSDPMI keeps some sanity about how much virtual memory will report according to the real memory you have. For example, I have 24 Mb free (after loading RHIDE), and CWSDPMI reports aprox. 150Mb free even if I have 300Mb free on disk. Windows will report even less. > The actual sequence of calls is: (it's to load each frame of a FLI into a > seperate buffer)... BTW the size of the FLI file is < 40Kb So why are you trying to decompress it first, make it on the fly, I think it will be faster because in this way you don't need to blit the whole screen. > * allocate a buffer for this frame (taken from frame_header.Size) > * allocate 64000 bytes and store the frame > * free the first buffer And perhaps here is the problem, when you allocate this temporal buffer and then deallocate it you are fragmenting the memory. To test if that's true try: 1) Allocate the temporal buffer just ones. or 2) Use my malloc function. > > ... and do this 62 times. > > Any ideas why I am running out of memory? Yes, fragmented memory is the most possible reason. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013