delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/18/14:15:27

Message-Id: <m0ybUQe-000S3wC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
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
Subject: Re: memory allocation
References: <MPG DOT fca1ce9290f6bfd98981e AT news DOT york DOT ac DOT uk>
In-reply-to: <Pine.SUN.3.91.980518172529.18855B-100000@is>

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> replied to Colin Blackburn <cgb3 AT york DOT ac DOT uk>
> 
> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019