Deleted objects still in the memory

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Deleted objects still in the memory

Post by AstghikM » Fri Sep 18, 2015 8:07 am

Hi everyone :)

I have a question about deleted objects from livecode file. All the objects that i have deleted from my project long time ago i can see now as for example "bkgn group "player" of stack "stackName" " and all the objects from all this time, could be button, substack and so on, with their codes inside. i have about 2003 deleted objects in search result. Can you please give me a solution? i deleted objects using

Code: Select all

delete control tControl of card pCardID
or

Code: Select all

delete group tControl of card pAreaID
and so on.

Thanks

Astghik

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Deleted objects still in the memory

Post by dunbarx » Fri Sep 18, 2015 1:41 pm

Hi.

The only thing that will prevent a "delete" command from working is if the command is invoked with a running script in the object in question. How are you searching for these objects?

If I make a card with a few controls on it, and delete some, they are gone. Can you make a test stack where they are not?

Craig Newman

AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Re: Deleted objects still in the memory

Post by AstghikM » Fri Sep 18, 2015 3:44 pm

dunbarx wrote: How are you searching for these objects?
Hi, thanks for reply

I am searching some function that was in deleted objects and it brings that object code. i am attaching a file, as you see it is 772kb but has only one button on it, and if you try to search in the script "get" or something else that can be in my code (ctrl+shift+F) it will go trough many controls and bring their code.
Attachments
DELETED - Copy.zip
(200.36 KiB) Downloaded 274 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Deleted objects still in the memory

Post by jmburnod » Fri Sep 18, 2015 6:55 pm

Hi Astghik and Craig
Thanks for this example.
I have got it.
I believe that is happened during an update.
We discuss it in this thread but we haven't found a solution except
cleaning cd per cd in a new stack. Craig Do you remember ?
http://forums.livecode.com/viewtopic.php?f=8&t=24228
Best regards
Jean-Marc
https://alternatic.ch

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Deleted objects still in the memory

Post by FourthWorld » Fri Sep 18, 2015 8:11 pm

Thanks for providing the stack. The groups in question were apparently removed but not deleted, resulting in having them present in the stack file but not placed on any card. This prevents them from being visible in the Project Browser, but you'll find them listed in the IDE's Object menu under the Place Groups submenu.

Tedious solution: place each one manually and manually delete it.

Faster solution: write a quick script to delete them, e.g.:

Code: Select all

on mouseUp
   put the backgroundIDs of this stack into tList
   repeat for each line tID in tList
      set the cantdelete of bg id tID to false
      delete bg id tID
   end repeat
end mouseUp
Saving after running that brought the stack file size down to 3.7k.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Deleted objects still in the memory

Post by dunbarx » Fri Sep 18, 2015 8:41 pm

So.

Can this be said to be an unflattering "feature" of the group paradigm, that would never have reared its head in HC with its single backGround object class? It is at least something to be aware of. When working on several versions of stacks with the same name, I always get caught with the dialog that asks me if I want to purge the current one. One might say that the extra effort to set the destroyStack property to "true" hardly qualifies as onerous, but it is also something to be aware of.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Deleted objects still in the memory

Post by FourthWorld » Fri Sep 18, 2015 9:08 pm

dunbarx wrote:So.

Can this be said to be an unflattering "feature" of the group paradigm, that would never have reared its head in HC with its single backGround object class? It is at least something to be aware of.
IMO the latter. Just about any feature in any language can be used to shoot yourself in the foot. Here the rule isn't hard to remember: if you want to delete a group, delete it; if you want to remove it from a card but keep it in the stack for later use, remove it.
When working on several versions of stacks with the same name, I always get caught with the dialog that asks me if I want to purge the current one. One might say that the extra effort to set the destroyStack property to "true" hardly qualifies as onerous, but it is also something to be aware of.
On that one my preference would be to replace the name "destroyStack" with something that's not unnecessarily scary (it doesn't actually delete the stack) so people would actually use it. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Deleted objects still in the memory

Post by jmburnod » Fri Sep 18, 2015 9:16 pm

Thanks All,
That is clearer for me now.
I wonder if we can use the owner to know if a group is placed on a cd or not
The owner of a placed group is an other group or a card.
If a group is not placed on a cd or in an other group placed on one cd LiveCode return an error "can't find background".

It means that is a good way to delete groups which are not placed on one cd ?
Best regards
Jean-Marc
https://alternatic.ch

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Deleted objects still in the memory

Post by FourthWorld » Fri Sep 18, 2015 9:26 pm

Good idea, Jean-Marc: when placed the owner of a group is the card, and when unplaced the owner is the stack.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Re: Deleted objects still in the memory

Post by AstghikM » Fri Sep 18, 2015 9:45 pm

FourthWorld wrote:... you'll find them listed in the IDE's Object menu under the Place Groups submenu.
oh i see, never thought to look there.
Faster solution: write a quick script to delete them, e.g.:

Code: Select all

on mouseUp
   put the backgroundIDs of this stack into tList
   repeat for each line tID in tList
      set the cantdelete of bg id tID to false
      delete bg id tID
   end repeat
end mouseUp
Saving after running that brought the stack file size down to 3.7k.
great!

Thank you all

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Deleted objects still in the memory

Post by jmburnod » Fri Sep 18, 2015 10:30 pm

Richard,
"when placed the owner of a group is the card, and when unplaced the owner is the stack"
I get an error message "can't find background" for the owner of a group unplaced on a cd
LiveCode is great we can use try.
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Deleted objects still in the memory

Post by dunbarx » Fri Sep 18, 2015 10:47 pm

I get an error message "can't find background" for the owner of a group unplaced on a cd
Confirmed here. The "owner" lives only in stacks. So does "exists", which throws the same error that Jean-Marc noted. And the owner of a mainstack is always empty.

Is there any analog for the stack file? There must be, because as Richard points out, LC "knows" about unplaced groups, since they are listed in the "Place group" menu, and it is a snap to re-place them.

@AstghikM. That must have been some list if you had 2000 unplaced groups.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Deleted objects still in the memory

Post by FourthWorld » Fri Sep 18, 2015 10:51 pm

When referring to an object that isn't on the current card you'll need to specify where it is, e.g.:

get the long id of bg 1 of this stack
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Re: Deleted objects still in the memory

Post by AstghikM » Sun Sep 20, 2015 6:24 pm

Hello everyone,
I just noticed another problem, when i copy some object or group of objects on one card, in that card "Objects/Place Group" is empty, but when i am on another card, where i did not copy the objects "Objects/Place Group" has the list of the objects, and if i place the objects and delete it will say that i have that objects in multiple cards, and if i delete the objects i will lost all, because the IDs are the same. so that is how i got a huge list of objects.
Thanks

Astghik

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Deleted objects still in the memory

Post by jmburnod » Sun Sep 20, 2015 6:42 pm

Hi Astghik,
because the IDs are the same
As far I know, I think they have the same id because they have bgbehavior to true

Jean-Marc
https://alternatic.ch

Post Reply