bugGNU Octave - Bugs: bug #61005, clear does not always clear

 
 

bug #61005: clear does not always clear

Submitter:  sylvain bougnoux <sbougnoux>
Submitted:  Tue 03 Aug 2021 02:10:06 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.3.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 03 Aug 2021 03:30:50 PM UTC, comment #5: 

Ok. I'll close this report as invalid in this case.

Markus Mützel <mmuetzel>
Group administrator
Tue 03 Aug 2021 02:51:43 PM UTC, comment #4: 

Yes thanks a lot
'clear -g h' works a well.
I guess IMHO when coming from other languages it is counter intuitive, but I understand now.
As said in the doc declaring 'global h', restore h from the global workspace to the current one.
The example is correct as not using global.

Thanks again.

sylvain bougnoux <sbougnoux>
Tue 03 Aug 2021 02:36:44 PM UTC, comment #3: 

The function `clear` only clears local variables from the current scope by default.
Does using `clear all` or `clear global` do what you expect?

See also the documentation for `clear`.

Markus Mützel <mmuetzel>
Group administrator
Tue 03 Aug 2021 02:33:26 PM UTC, comment #2: 

Sorry 'h' its not a handle, I got confused, it is a regular scalar structure. I inspired from this code.

https://github.com/gnu-octave/macgyver_utils/blob/master/demo_uicontrol.m

'h' is just declared global and filled inside functions when creating widgets like 'h.box=uicontrol(...)'.

sylvain bougnoux <sbougnoux>
Tue 03 Aug 2021 02:24:47 PM UTC, comment #1: 

It's not clear to me what you mean by "store its handle 'h'".

A graphics handle in Octave "is" a double scalar. But following up, you write that you are adding a field to `h`. That should result in an error if `h` indeed is a double scalar.

So what exactly is the "handle 'h'"? Where do you store it? Where do you get it from?

Markus Mützel <mmuetzel>
Group administrator
Tue 03 Aug 2021 02:10:06 PM UTC, original submission:  

It does not always happen but I remarked the following (maybe it is related to strange feed-backs about memory some others have posted?).

I create a gui (in a frame) and store its handle 'h' (as in the example).
Then sometimes I create a field (like 'h.foo=1')
Then I clear (I've tried 'clear; clear h; close all')
Then the variable 'h' does not exist anymore, fine.
Up to this, everything is correct.
Then I relaunch my script & recreate 'h' the same way but without adding field 'foo'.
Then up to my surprise, sometimes 'foo' still belongs to 'h', like 'h.foo' does exist!!!
Then I cannot get rid of 'h.foo' through the various clear mentioned above, I've to restart Octave.

Unfortunately it does not always happen, maybe only when the mapping of memory happens similarly (up to what it means?).

I send you this to help pinpoint a real issue. Hope this helps.

sylvain bougnoux <sbougnoux>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by sbougnoux (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-03 mmuetzel StatusNeed Info Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2021-08-03 mmuetzel StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code