From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Oct 28 2010 - 13:11:30 CDT

On Thu, Oct 28, 2010 at 2:05 PM, Ajasja Ljubetič
<ajasja.ljubetic_at_gmail.com> wrote:
> Dear Alex,
> well, I can believe that (very) few people encounter this error.
> I'm only worried about memory leaks. (But not that much, since I have at
> most a few tens of such selections).

you don't have to worry about this.

> If the call $sel delete fails, then one would assume the selection remains
> in memory. So does that mean then I could just skip the calls to $sel

no, the selection will be freed. the error message
originates from something else, that is hard to explain
in one sentence. as i wrote before. i can give you a
detailed explanation and even the code that should
help to correct that, if you are curious about these things
(or anybody else). but i need to look up the details
to make sure i am explaining it right and extract the
right code from my tree.

cheers,
   axel.

> delete?
> Best regards,
> Ajasja
>
> On Thu, Oct 28, 2010 at 16:22, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>
>> dear ajasja,
>>
>> On Thu, Oct 28, 2010 at 7:56 AM, Ajasja Ljubetič
>> <ajasja.ljubetic_at_gmail.com> wrote:
>> > Dear all,
>> > I believe the following script should work, but it returns "can't unset
>> > "upproc_var_atomselect23903": no such variable" .
>>
>> you are triggering an "undocumented feature" in VMD.
>>
>> if you want the long explanation and the code to remove
>> the inconsistency in this behavior, you'll have to give me
>> some time to dig it out of my private VMD tree. i've been
>> proposing a couple of times to have this fixed, but it has
>> been put on the backburner, since so extremely few people
>> run into this issue, and the changes would require extensive
>> testing to make sure no existing script/plugin is broken by it.
>> since atom selections are such a key feature in VMD, the
>> reluctance to apply this kind of change is very understandable.
>>
>> the short explanation is: don't worry. it is a side effect of
>> $sel global and can be ignored. try replacing:
>>
>>  $sel delete
>>
>> with:
>>
>>  catch { $sel delete } msg
>>
>> and your code should work fine.
>>
>> cheers,
>>    axel.
>>
>>
>> > Best regards,
>> > Ajasja
>> >
>> >
>> > proc freesel {sel} {
>> >  $sel delete
>> > }
>> > proc atest {sel} {
>> >   set a [atomselect top $sel]
>> >   $a global
>> >   return $a
>> > }
>> > proc dotest {} {
>> >   set selx [atest "protein"]
>> >   freesel $selx
>> > }
>> > dotest
>>
>>
>>
>> --
>> Dr. Axel Kohlmeyer
>> akohlmey_at_gmail.com  http://goo.gl/1wk0
>>
>> Institute for Computational Molecular Science
>> Temple University, Philadelphia PA, USA.
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.