FWIW, tested on an android device with plenty of memory Deleting stacks isn't helping. My Nexus 5 has 1 GB free RAM even with all of Google's widgets and my app open and going from Stack B back to stack A then deleting StackcB in 10 milliseconds is "nothing" in terms of memory requirement, but crashes in Android every time…
I have a report in to HQ… On 2/11/17, 8:38 AM, "use-livecode on behalf of Sannyasin Brahmanathaswami via use-livecode" <use-livecode-boun...@lists.runrev.com on behalf of use-livecode@lists.runrev.com> wrote: I'm trying to optimize for minimal RAM usage on mobile. The app is modular with many stacks that are opened from the mainstack. I had this before in a global library: command portal_GoStack stackName -- goes to the new stack -- closes the current stack # But we want to delete it to clear RAM -- safely ignores if we are alrady in the new stack put the short name of this stack into oStackName if oStackName = stackName then return oStackName go to stack stackName --close stack oStackName -- test deleting the stacks to save on RAM delete stack oStackName return oStackName end portal_GoStack This is called from a button on a navigation bar of the stack we want to close and delete, as it opens a different stack. This works if we just use "close stack oStackName" but if I change this to "delete stack oStackName" we get an error: stack "lib_SivaSivaPortal": execution error at line n/a (Object: stack locked, or object's script is executing) near "widget "go-home-portal" of group "homeScreensBottomNav" of card "images-quotes" of stack "/Users/Brahmanathaswami/Documents/_Siva-Siva-App/modules/gems/gems.livecode"" Obviously this means that the stack "gem.livecode" which has the button which is trying to "navigate" back to the home/main stack, cannot be deleted because the button script that calls the library handler is considered to be executing. Closing it first before deleting does not help. so I tried using "send in 10 milliseconds" And this *does* work.. I'm just trying to see if this is best practice. both stacks will occupy RAM briefly, but there is no other way that I know of to avoid this without a "flash" of some empty screen. command portal_GoStack stackName -- goes to the new stack -- closes the current stack -- safely ignores if we are alrady in the new stack put the short name of this stack into oStackName if oStackName = stackName then return oStackName go to stack stackName send "removeStack oStackName" to me in 10 milliseconds return oStackName end portal_GoStack command removeStack stackName delete stack stackName end removeStack Stack A opens Stack B opens on top Stack B want to close itself, be deleted (removed from memory) and open stack A Anyone has gone through this loop already and discovered best practices to accomplish this? BR _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode