Skip to content
Tcl Source Code History Of Ticket 862924ffffffffff
Login

History Of Ticket 862924ffffffffff

Artifacts Associated With Ticket 862924ffffffffff

  1. Ticket change [8442a491d5] (rid 117522) by tclfuchs on 2003-12-19 13:15:52:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      I found some Memory leaks. Memory is allocated by
      c-system-functions like localtime() and assigned to
      variables, which are not freed afterwards. Might be,
      there are many more leaks of this kind (?!)...
      
      file tclGetDate.y, function NamedDay: Variable tm
      file tclGetDate.y, function NamedMonth: Variable tm
      file tclGetDate.y, function RelativeMonth: variable tm
      file tclGetDate.y, function TclGetDate: variable tm
      file tclUnixTime.c, function TclpGetTimeZone, variable
      timeDataPtr and variable stm
      
      
      
      
    4. foundin initialized to: "obsolete: 8.4.5"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "tclfuchs"
    9. subsystem initialized to: "41. Memory Allocation"
    10. title initialized to: "Memory Leak in Time/Date-Functions"
    11. type initialized to: "Bug"
  2. Ticket change [9599a0ae18] (rid 106181) by dkf on 2003-12-19 21:34:59:

    1. assignee changed to: "kennykb"
    2. subsystem changed to: "06. Time Measurement"
  3. Ticket change [9f500f99a0] (rid 96621) by tclfuchs on 2003-12-22 17:17:43:

    1. icomment:
      Logged In: YES 
      user_id=934391
      
      Could you please also have a look at unix/tclUnixTime.c.
      Maybe it could be rewritten as
      struct tm *TclpGetDate(time, useGMT)
          TclpTime_t time;
          int useGMT;
         struct tm *temp;
      {
          CONST time_t *tp = (CONST time_t *)time;
      
          if (useGMT) {
              temp=gmtime(tp);
              free(tp);
              return temp;
          } else {
              temp=localtime(tp);
              free(tp);
              return temp;
          }
      }
      
      The same applies to /win/tclWinTime.c with variable tp, but
      this function is a bit more tricky.
      
      In /mac/tclMacTime.c the function TclpGetDate seems to be
      not-threadsafe. A pointer to static variable "statictime" is
      returned from this function, but this variable is influenced
      by other threads. Even in single-threaded programms problems
      arise, if not carefully used: The user has to copy the data
      of the returned pointer to another memory location, because
      the next call to TclpGetDate would override the result of
      the previous call.
      
      
      
    2. login: "tclfuchs"
    3. mimetype: "text/plain"
    4. username: "tclfuchs"
  4. Ticket change [4a8ae18679] (rid 126551) by kennykb on 2004-03-05 23:30:21:

    1. assignee changed to: "das"
    2. icomment:
      Logged In: YES 
      user_id=99768
      
      The variable returned by 'localtime' is in fact supposed
      to be static, rather than dynamically allocated.  If
      a memory management tool is reporting the 'struct tm'
      in these functions as being leaked, it is either the tool or
      the C library that is in error.  Freeing the memory
      returned by 'localtime' would be a catastrophic bug.
      
      The code in tclUnixTime.c has been replaced with the
      'ThreadSafeGMTime' and 'ThreadSafeLocalTime'
      functions some time ago.  Those functions use
      gmtime_r and localtime_r if available, and protect the
      operation with a mutex if they are not available.
      
      The Unix code for these functions uses a thread-specific
      data block; these blocks are cleaned up automatically
      in Tcl_FinalizeThread upon exit from the thread.
      
      Since Classic Mac is not supported, and the proposal
      is afloat to move the mac/ directory to the Attic,
      I question whether it's necessary at the moment to
      do anything with tclMacTime.c.  I'm assigning this bug
      over to the last known maintainer of the Mac code
      to see if he wants to do anything with it.
      
      In short: I see no leaks; the Classic Mac code may have
      issues with thread safety.
      
      
    3. login: "kennykb"
    4. mimetype: "text/plain"
    5. priority changed to: "1 Zero"
    6. username: "kennykb"
  5. Ticket change [a53f213434] (rid 110339) by das on 2004-03-08 10:15:15:

    1. closedate changed to: "2004-03-08T03:15:15"
    2. closer changed to: "das"
    3. icomment:
      Logged In: YES 
      user_id=90580
      
      thread safety in tclMacTime.c is not an issue as Mac Classic 
      doesn't support pre-emptive threads... so I see no problem here.
      in any case, as Kenny said, the mac classic code will be 
      removed from 8.5.x.
      Closing this as Invalid
      
      
    4. login: "das"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "das"