Re: a Free required?

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 04/04/98


>     I'm reall unsure about using Free and stuff.
>
> this is what i've got.
>
>     CREATE (rolls, struct new_player_rolls, 1);
>     rolls->points = 12;
>     rolls->group = GROUP_UNDEFINED;
>     rolls->class = CLASS_UNDEFINED;
>     players_rolls(d, rolls, ATT_UNDEFINED, 0);
>     STATE(d) = CON_ROLLS;
>
> should i have a FREE(rolls) or whatever it is called, at the end of my
> case CON_ROLLS or what not when i'm finished with rolling ?

    Free is used to release memory that is no longer needed.  If you
allocate memory (Via the CREATE macro in this case), you should free it up
when you are done using it.  For example, poofin/out are freed when a
character quits, and allocated when they enter the game.
        Though I don't know exactly what you're going to do with this, I'd
recommend that you not free the structure untill you either
        a) are finished with the structure
        b) plan on throwing away the old one and replacing it with a new
one (which really means your finished with it).

        Thats about it.  Don't free something and try and use it, or
you'll probably seg fault.

                                                PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST