Path: utzoo!dciem!nrcaer!julie!mcr From: mcr@julie.UUCP (Michael Richardson) Newsgroups: comp.sys.amiga.tech Subject: Re: memalign (can it be simulated?) Message-ID: <0248.AA0248@julie> Date: 30 Jan 89 22:09:44 GMT Article-I.D.: julie.0248.AA0248 References: <5471@bsu-cs.UUCP> Distribution: world Organization: Sandleman Software Works' Debugging Department, Ottawa, ON Lines: 53 >In article <0164.AA0164@julie>, mcr@julie.UUCP (Michael Richardson) writes: >> >> I have discovered that the Manx malloc is a fake - is uses a 40K >> arena which is allocated at run time regardless of how much malloc'ing > >How did you determine this? The source to Manx's malloc shows it calling >lmalloc which in turn calls AllocMem with the size of your request plus room >for a tag to allow the clean up routine to free it on exit. > >-- >Brian Waters !{iuvax|pur-ee}!bsu-cs!jbwaters > uunet!---/ (I also read the other reply in case you are wondering) Page 11-50 of my badly ordered, misindexed, and half missing Manx manual says (in reference to malloc): "It allocates a buffer from the first large enough free block that it encounters. If this search fails, it calls sbrk to get more memory for use by these functions." Page 11-11 (sbrk): "When first called, sbrk gets a block of memory by calling the Amiga function AllocMem. The default size of this block is 40K bytes." ... "ERRORS If an sbrk request would make the sbrk pointer go past the end of sbrk's block of memory, sbrk will return -1 as its value, without modyfying its pointer." BTW: Wouldn't be surprised if my manual is wrong... Regardless, there isn't a proper memalign function. (nor even an inefficient one. - I'll go the AllocMem/FreeMem route - maybe with bigger blocks, I don't know - my program will eventually FreeMem all the blocks it allocates after a garbage collection and reallocate more memory afterward. This might slowly compact the heap if nothing else is busy doing the same.) Also: My manual is missing the fexec functions... (exec() 'See Also's them) Will this work? freopen("in","r",stdin); (==NULL - error...) error=fexec("myprog","myprog","myarg",0); if(error) ... Thanks! -- :!mcr!: Michael Richardson Amiga v--------+ UUCP: uunet!attcan!lsuc!nrcaer!julie!mcr | INTERNET mcr@doe.carleton.ca Fido: Michael Richardson @ 1:163/109.10<--+ Alter @ 7:483/109.10