From: dontmailme AT iname DOT com (Steamer) Newsgroups: comp.os.msdos.djgpp Subject: Re: Unstandard mallocation needed Date: Sun, 25 Jun 2000 11:20:42 GMT Organization: always disorganized Lines: 29 Message-ID: <3955eae8.9744806@news.freeserve.net> References: <384735753 DOT 961926689108 DOT JavaMail DOT root AT web443-mc DOT mail DOT com> NNTP-Posting-Host: modem-114.south-carolina.dialup.pol.co.uk X-Trace: news6.svr.pol.co.uk 961932043 22462 62.137.91.114 (25 Jun 2000 11:20:43 GMT) NNTP-Posting-Date: 25 Jun 2000 11:20:43 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Martin Nilsson wrote: > The comp.lang.c FAQ says > > 7.27 > Q: So can I query the malloc package to find out how big > an allocated block is? > > A: Unfortunately, there is no standard or portable way. > > > but I would like to do it anyway, with DJGPP. None of the > memory allocation routines listed in info.exe seem to fit. > Does somebody know how to do it? #define BLOCKSIZE(p) (*((unsigned*)((char*)(p)-4))&~1) Works with DJGPP 2.03 anyway, but I don't know about other versions. > It would be extra nice if > the solution was somwhat portable to the GNU GCC compiler. Not much hope of that. It may even break in the very next version of DJGPP for all I know. This sort of thing depends entirely on the way malloc is implemented and is highly non-portable. So don't do it... S.