Re: [cc65] Memory allocation question

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-08-17 12:18:05
On Mon, Aug 17, 2009 at 12:48:30AM -0500, Scott Hutter wrote:
> I think I already know the answer to this one, but will ask to be sure.
> Upon a program termination, all malloc()'ed memory is free()'ed back to the
> system?  Im writing for the Commodore 128, and my assumption of course, is
> that when a program terminates, the system (memory pointers and such) are
> all back to a normal power-on state.  To that regard, is there anything that
> would not be back in "power-on" state upon program termination due soley to
> the compiler? (ie modified zero page values, etc,)

If the program terminates correctly (by leaving main or calling exit), open
files are closed, zeropage as used by the compiler is restored and any changed
kernal vectors are reset. Since the C128 kernal does not really have memory
management and the heap is just part of the program, malloc'ed memory is
automatically "free'd" on termination.

Graphics mode is the only thing that isn't restored, otherwise program output
would be illegible once the program ends.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Aug 17 12:19:23 2009

This archive was generated by hypermail 2.1.8 : 2009-08-17 12:19:25 CEST