Menu

#2786 Resource leak in [pkgconfig] ?

obsolete: 8.5a2
closed-fixed
9
2007-11-28
2004-07-01
Don Porter
No

Tcl_RegisterConfig() creates a [pkgconfig]
command. Configuration values are stored
in a dictionary, and the [pkgconfig] command
provides read access to the dictionary.

When the [pkgconfig] command is
deleted from the interp, the dictionary
of data remains, it is not freed until
the interp is deleted. The elements
of the dictionary may be freed as they
are overwritten by a later call to
Tcl_RegisterConfig() on the same interp.

Besides an unbalanced cleanup, this
also opens the possibility of having
[pkgconfig] return data values that
are a mixture of different Tcl_RegisterConfig()
calls (possibly from multiple versions of
the same package?).

I think we want QueryConfigDelete() to
clear the dictionary of data.

Discussion

  • Andreas Kupries

    Andreas Kupries - 2004-07-16

    Logged In: YES
    user_id=75003

    Agree. But we have a problem here. QueryConfigDelete does
    not get the interp, but the dictionary you ask it to delete
    is found only through the assoc data of an interp. So we
    can't find the dict right now.

    This requires a change to the client data of the command.
    Instead of the package name, as done right now we have to
    use a struct which contains the package name, and a
    reference to the relevant interp. the name is required
    everywhere, the interp is relevant only for the cleanup.

     
  • Don Porter

    Don Porter - 2006-03-10
    • priority: 5 --> 9
     
  • Andreas Kupries

    Andreas Kupries - 2006-03-27

    Logged In: YES
    user_id=75003

    This is not blocker for the a4 release IMHO.

     
  • Andreas Kupries

    Andreas Kupries - 2006-03-27
    • priority: 9 --> 8
     
  • Don Porter

    Don Porter - 2007-11-27

    Logged In: YES
    user_id=80530
    Originator: YES

    status?

     
  • Andreas Kupries

    Andreas Kupries - 2007-11-27

    Logged In: YES
    user_id=75003
    Originator: NO

    Nothing was done :(

    I have no objections to deletion via QueryConfigDelete() when the command goes away.

     
  • Don Porter

    Don Porter - 2007-11-27
    • assigned_to: andreas_kupries --> dgp
    • priority: 8 --> 9
     
  • Don Porter

    Don Porter - 2007-11-28

    Logged In: YES
    user_id=80530
    Originator: YES

    Here's a patch for review.
    File Added: 983501.patch

     
  • Don Porter

    Don Porter - 2007-11-28
    • assigned_to: dgp --> andreas_kupries
     
  • Don Porter

    Don Porter - 2007-11-28
     
  • Andreas Kupries

    Andreas Kupries - 2007-11-28

    Logged In: YES
    user_id=75003
    Originator: NO

    Patch looks good.

     
  • Don Porter

    Don Porter - 2007-11-28

    Logged In: YES
    user_id=80530
    Originator: YES

    committed for 8.5.0

     
  • Don Porter

    Don Porter - 2007-11-28
    • assigned_to: andreas_kupries --> dgp
    • status: open --> closed-fixed