Reducing a total amount of memory usage of an edge device by swapping application logics
View Patent ↗Provided are techniques for reducing a total amount of memory usage of an edge device by swapping application logics. A first application is executed in a foreground on an application framework, where the first application has a shown status. In response to receiving a request to execute a swap application, it is determined that the first application and the swap application use a same screen type and a same non-shareable resource. An application logic of the first application is stored in a suspended application logic pool, where the first application changes from the shown status to a hidden-suspended status. The swap application is executed in the foreground on the application framework, where the swap application has the shown status.
1 . A computer-implemented method, comprising operations for:
grouping a first application and a swap application that share an application framework, wherein one of the first application and the swap application executes in the application framework at a time;
executing the first application in a foreground on the application framework, wherein the first application has a shown status and is attached to the application framework; and
in response to receiving a request to execute the swap application,
determining that the first application and the swap application use a same screen type and a same non-shareable resource;
storing an application logic of the first application in a suspended application logic pool, wherein the first application changes from the shown status to a hidden-suspended status and is detached from the application framework; and
executing the swap application in the foreground on the application framework, wherein the swap application has the shown status and is attached to the application framework.
2 . The computer-implemented method of claim 1 , wherein the operations further comprise:
receiving a request to execute the first application again;
storing an application logic of the swap application in the suspended application logic pool, wherein the swap application changes from the shown status to the hidden-suspended status;
retrieving the application logic of the first application from the suspended application logic pool; and
executing the first application in the foreground, wherein the first application changes from the hidden-suspended status to the shown status.
3 . The computer-implemented method of claim 1 , wherein the operations further comprise:
in response to receiving a request to execute a non-swap application,
executing the first application in a background, wherein the first application changes from the shown status to a hidden status; and
executing the non-swap application in the foreground on the application framework, wherein the non-swap application has the shown status.
4 . The computer-implemented method of claim 3 , wherein the operations further comprise:
receiving a request to execute the first application again;
executing the first application in the foreground, wherein the first application changes from the hidden status to the shown status; and
executing the non-swap application in the background, wherein the non-swap application changes from the shown status to the hidden status.
5 . The computer-implemented method of claim 1 , wherein the operations further comprise:
determining that memory usage exceeds a threshold; and
discarding one or more application logics in the suspended application logic pool to free space in memory.
6 . The computer-implemented method of claim 1 , wherein memory usage comprises memory for the application framework, the first application, and the swap application.
7 . The computer-implemented method of claim 1 , wherein the application framework comprises a first application framework, and wherein other applications are grouped to share a second application framework.
8 . A computer program product, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a processor to cause the processor to perform operations for:
grouping a first application and a swap application that share an application framework, wherein one of the first application and the swap application executes in the application framework at a time;
executing the first application in a foreground on the application framework, wherein the first application has a shown status and is attached to the application framework; and
in response to receiving a request to execute the swap application,
determining that the first application and the swap application use a same screen type and a same non-shareable resource;
storing an application logic of the first application in a suspended application logic pool, wherein the first application changes from the shown status to a hidden-suspended status and is detached from the application framework; and
executing the swap application in the foreground on the application framework, wherein the swap application has the shown status and is attached to the application framework.
9 . The computer program product of claim 8 , wherein the program instructions are executable by the processor to cause the processor to perform further operations for:
receiving a request to execute the first application again;
storing an application logic of the swap application in the suspended application logic pool, wherein the swap application changes from the shown status to the hidden-suspended status;
retrieving the application logic of the first application from the suspended application logic pool; and
executing the first application in the foreground, wherein the first application changes from the hidden-suspended status to the shown status.
10 . The computer program product of claim 8 , wherein the program instructions are executable by the processor to cause the processor to perform further operations for:
in response to receiving a request to execute a non-swap application,
executing the first application in a background, wherein the first application changes from the shown status to a hidden status; and
executing the non-swap application in the foreground on the application framework, wherein the non-swap application has the shown status.
11 . The computer program product of claim 10 , wherein the program instructions are executable by the processor to cause the processor to perform further operations for:
receiving a request to execute the first application again;
executing the first application in the foreground, wherein the first application changes from the hidden status to the shown status; and
executing the non-swap application in the background, wherein the non-swap application changes from the shown status to the hidden status.
12 . The computer program product of claim 8 , wherein the program instructions are executable by the processor to cause the processor to perform further operations for:
determining that memory usage exceeds a threshold; and
discarding one or more application logics in the suspended application logic pool to free space in memory.
13 . The computer program product of claim 10 , wherein memory usage comprises memory for the application framework, the first application, and the swap application.
14 . The computer program product of claim 10 , wherein the application framework comprises a first application framework, and wherein other applications are grouped to share a second application framework.
15 . A computer system, comprising:
one or more processors, one or more computer-readable memories and one or more computer-readable, tangible storage devices; and
program instructions, stored on at least one of the one or more computer-readable, tangible storage devices for execution by at least one of the one or more processors via at least one of the one or more computer-readable memories, to perform operations comprising:
grouping a first application and a swap application that share an application framework, wherein one of the first application and the swap application executes in the application framework at a time;
executing the first application in a foreground on the application framework, wherein the first application has a shown status and is attached to the application framework; and
in response to receiving a request to execute swap application,
determining that the first application and the swap application use a same screen type and a same non-shareable resource;
storing an application logic of the first application in a suspended application logic pool, wherein the first application changes from the shown status to a hidden-suspended status and is detached from the application framework; and
executing the swap application in the foreground on the application framework, wherein the swap application has the shown status and is attached to the application framework.
16 . The computer system of claim 15 , wherein the program instructions perform operations further comprising:
receiving a request to execute the first application again;
storing an application logic of the swap application in the suspended application logic pool, wherein the swap application changes from the shown status to the hidden-suspended status;
retrieving the application logic of the first application from the suspended application logic pool; and
executing the first application in the foreground wherein the first application changes from the hidden-suspended status to the shown status.
17 . The computer system of claim 15 , wherein the program instructions perform operations further comprising:
in response to receiving a request to execute a non-swap application,
executing the first application in a background, wherein the first application changes from the shown status to a hidden status; and
executing the non-swap application in the foreground on the application framework, wherein the non-swap application has the shown status.
18 . The computer system of claim 17 , wherein the program instructions perform operations further comprising:
receiving a request to execute the first application again;
executing the first application in the foreground, wherein the first application changes from the hidden status to the shown status; and
executing the non-swap application in the background, wherein the non-swap application changes from the shown status to the hidden status.
19 . The computer system of claim 15 , wherein the program instructions perform operations further comprising:
determining that memory usage exceeds a threshold; and
discarding one or more application logics in the suspended application logic pool to free space in memory.
20 . The computer system of claim 15 , wherein memory usage comprises memory for the application framework, the first application, and the swap application.