[iconv crashes]

Akira Higuchi a-higuti@math.sci.hokudai.ac.jp
Thu Jun 1 12:05:00 GMT 2000


Hello.
Thank you for your reply.

In article < 20000601083343.A7683@lucon.org >
hjl@lucon.org writes:

>> -------------- x8-------------- x8-------------- x8--------------
>> --- iconv/gconv_dl.c.org        Thu Jun  1 14:56:45 2000
>> +++ iconv/gconv_dl.c    Thu Jun  1 17:55:19 2000
>> @@ -154,9 +154,9 @@
>>      return;
>>  
>>    if (obj == release_handle)
>> -    /* This is the object we want to unload.  Now set the release
>> -       counter to zero.  */
>> -    obj->counter = 0;
>> +    /* This is the object we want to unload.  Now decrement the reference
>> +       counter.  */
>> +    obj->counter--;
>>    else if (obj->counter <= 0)
>^^^^^^^^^^^^^^^^^^^^^
>
>It doesn't look right to me. It should look like
>
>   if (obj->counter <= 0)
>
>>      {
>>        if (--obj->counter < -TRIES_BEFORE_UNLOAD && obj->handle != NULL)
>> -------------- x8-------------- x8-------------- x8--------------

My understanding about do_release_shlib is as follows.

  for each module 'obj' on memory {
    if 'obj' is what we want to release {
      Decrement the ref counter, but never unload the shlib even if the
      counter is reached to 0. It will remain on memory for a while.
    } else if ('obj' has not been used for a long time) {
      Unload 'obj'.
    }
  }

The reference counter seems to have a meaning something like:
  obj->counter < -TRIES_BEFORE_UNLOAD means that shlib is not loaded.
  -TRIES_BEFORE_UNLOAD <= obj->counter <= 0 means that shlib is loaded
  	but not used.
  obj->counter > 0 means shlib is loaded and used.

Am I misunderstanding?

--------------------------------------
Akira Higuchi
Dept. of Mathematics, Hokkaido Univ.
Sapporo, Japan
a-higuti@math.sci.hokudai.ac.jp
a@kondara.org


More information about the Libc-alpha mailing list