Re: allocate() and free()
- Posted by Derek Parnell <dparnell at BIGPOND.NET.AU> Dec 02, 2000
- 566 views
----- Original Message ----- From: "Robert Craig" <rds at RAPIDEUPHORIA.COM> > > > > ...The release_mem() routine gives back > > the memory to Windows for other applications to use. > > release_mem() appears to call Euphoria's free(). It does in earlier versions. I replaced all this with calls to the Windows library routines instead. The current library does not use Euphoria's routines (directly anyhow). > C programs on the Amiga or any other system > would likely work the same way. The heap memory > used by C's malloc() and free() is not returned to the > O/S until the application terminates. It's not practical > for any O/S to take back a small piece of memory > from the middle of your address space. It depends on the C implementation for the Amiga. The Amiga OS has native library routines that implement global malloc() and free() type operations. If the C complier uses these then freed memory is immediately available for oher processes. If the C complier is just ported to the Amiga, rather than optimised for it, then Robert is quite correct. The Watcom Amiga C compiler was a port from unix and it had its own heap management, and heap memory was not returned until the application finished. The Aztec C compiler choose to optimise the malloc() etc routines so that they directly called the Amiga system library. Other Amiga languages such as Amiga Basic, Blitz, AMOS, and E used the system library. ------ Derek Parnell Melbourne, Australia (Vote [1] The Cheshire Cat for Internet Mascot)