Page 1 of 2
Deleted objects still in the memory
Posted: Fri Sep 18, 2015 8:07 am
by AstghikM
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 1:41 pm
by dunbarx
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 3:44 pm
by AstghikM
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.
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 6:55 pm
by jmburnod
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 8:11 pm
by FourthWorld
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.
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 8:41 pm
by dunbarx
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 9:08 pm
by FourthWorld
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.

Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 9:16 pm
by jmburnod
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 9:26 pm
by FourthWorld
Good idea, Jean-Marc: when placed the owner of a group is the card, and when unplaced the owner is the stack.
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 9:45 pm
by AstghikM
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 10:30 pm
by jmburnod
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.
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 10:47 pm
by dunbarx
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
Re: Deleted objects still in the memory
Posted: Fri Sep 18, 2015 10:51 pm
by FourthWorld
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
Re: Deleted objects still in the memory
Posted: Sun Sep 20, 2015 6:24 pm
by AstghikM
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
Re: Deleted objects still in the memory
Posted: Sun Sep 20, 2015 6:42 pm
by jmburnod
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