Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: djgpp AT delorie DOT com, cgb3 AT york DOT ac DOT uk Date: Mon, 18 May 1998 15:23:53 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: memory allocation References: In-reply-to: Precedence: bulk Eli Zaretskii replied to Colin Blackburn > > On Mon, 18 May 1998, Colin Blackburn wrote: > > > I need to malloc a chunk of memory < 64K, I also need to be sure that > > this memory does not cross a 64K page boundary. > > The usual way to do this is to allocate 128K and use the part that's > 64K-aligned. Is more efficient to allocate the needed memory, if it crosses then reduce the size to cover the cross-point and then allocate again, finally release the unused memory. It could fail if the memory is too fragmented, but you can try again (and again). Normally it never fails and you doesn't use twice the needeed memory. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013