I am developing an Android game using the JS framework. I want to make sure that some objects are garbage collected as soon as I use them. How to make him? Should I use null or undefined?
You cannot forcibly collect garbage (not within reasonable limits).
If your variables do not automatically go beyond, just set them to null .
null
The best advice is to identify them in an area that makes them suitable for garbage collection. This means that you do not use global variables that never become available for collection. Instead, declare them as locals.
You can set it to null, and if this is the last reference to this object, it will have the right to garbage collection.
http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/
TGH's suggestion is the best, although I would recommend it.
Source: https://habr.com/ru/post/948746/More articles:Creating a Pascal Triangle (unstable code) - cExpand variables in sed - variablesActivityNotFoundException: No activity was detected to handle Intent - androidProper use of "getInstance" and static methods in PHP? - phpHow to solve the "No activity to handle Intent" problem - androidIs there a way to download source code from cloud services in Windows Azure? - cloudHow to create a nested array of arbitrary depth in java? - java2 PostgreSQL indexes in one column of one table - redundant? - sqlhtml5 required attribute for unsupported browsers - jqueryReject popover when iPad is in the background - iosAll Articles