www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/23/19:20:58

From: Leon AT caresystems DOT com DOT au
To: djgpp AT delorie DOT com
Date: Thu, 24 Aug 2000 09:30:03 +1000
MIME-Version: 1.0
Subject: one more about memory alloc - free memory of needed amount only
Message-ID: <39A4EB1B.29871.12C6F4@localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp AT delorie DOT com

Hello sorry to revisit this subejct but

a day or two ago i asked about possibility of alligning memory
so that say malloc(25) returns address x and then one modulates this address
so that it is alligned to a multiple of say 64 bytes. (by making malloc(25+63))

the problem is - how would one free memory that is a remainder of offset?
for example say malloc returns 5 (pseudo example only) so then one 
modifies it to say 10...
now the memory from location 5 to location 9 is theoretically not used
and thus could be used when some other allocation needs to take place - 
the thing is - how can i free memory from locaton 5 to location 9 keeping the rest (from loc 10 to whatever was allocated)...

is there some sort of free(ptr,x) 
call which would only free a certain portion starting at ptr and for amount of x bytes?

- Raw text -


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