Menu

#40 Log.c could stand to be cleaned up a lot.

open
nobody
None
4
2003-02-09
2003-01-29
No

I've noticed what would seem to be a problem with the
compression stuffs. When the compress() or
uncompress() functions are called, they run
init_compress(), which pulls in the compression
dictionary from the wordslist file if it's not already loaded.
Now, the db_read() function in db.c loads the wordslist
from the database into the dictionary. Normally, the DB
would be read before uncompress()/compress() are ever
called, so the DB's version of the wordslist would be
stored. But, there's a problem. Several times before the
db_read() function is called, log_status() is called.
log_status() calls wall_logwizards(), which calls
uncompress(), which inits the dictionary using the
wordslist file. When db_read() is called later, it loads the
dictionary -again-, right on top of what init_compress()
had already loaded, leaving unfreed memory about and
wasting time by loading the dictionary twice. Perhaps
remove the log_status() calls up until the database is
loaded, or modify them to use a new log_status()
function that doesn't call wall_logwizards().

-Hinoserm

Discussion

  • R Taylor

    R Taylor - 2003-01-31
    • assigned_to: nobody --> foxsteve
     
  • R Taylor

    R Taylor - 2003-01-31

    Logged In: YES
    user_id=42132

    Can you take a look into fixing this?

    To be honest, I can't think of why wall_wizards() and
    ansi_wall_wizards() even need an uncompress() call... The
    data sent to them isn't likely to be raw from props anyway.
    But may as well leave it in there just in case.

    I would like to have made it so that log_status() took a BOOL
    indicating whether or not it should call wall*() functions, but
    in taking a look at how many log_status() calls there are
    throughout the code, that seems like too much work.

    So instead, let's go for the other idea you offered, to make a
    different log_status() function that doesn't call wall*() wizards
    functions to be used by all of the startup status logging.

    I don't want to remove those log_status() calls as they are
    pretty helpful in debugging startup problems for me. I'm
    trying to get 1.8 out really soon (again) and would like this
    fixed in that release.

    -Akari

     
  • Michael Pratte

    Michael Pratte - 2003-02-02

    Logged In: YES
    user_id=340748

    Fixed as of the latest revisions of interface.c, game.c, log.c,
    tune.c and inc/externs.h. I also made a mistake and changed
    signal.c during the same commit, which was to add a newline
    to the log_status in my self-restarting resolver code. I've also
    changed a few other files over the last few days fixing other
    small bugs that seemed too small to give bug reports on.

    I added a new function to log.c, log_status_nowall(), and used
    that throughout the code up until db_read() is called.

    What I'd really like to do is rewrite log.c so as it's not just the
    same code repeated ten times over, but rather have a single
    generic function that the other log_*() functions can call. I'll
    work on that next and close this bug report once finished, but
    for the most part, this is all set for the release if I don't get
    log.c done in time.

    -Hinoserm

     
  • R Taylor

    R Taylor - 2003-02-09
    • labels: 102886 -->
    • milestone: 101714 -->
    • priority: 7 --> 4
    • assigned_to: foxsteve --> nobody
    • summary: Compression bug --> Log.c could stand to be cleaned up a lot.
     
  • R Taylor

    R Taylor - 2003-02-09

    Logged In: YES
    user_id=42132

    Good work. Moving this to feature requests under the subject
    of 'cleaning up log.c to be smaller'.

    -Akari

     

Log in to post a comment.

Monday.com Logo