smichak
smichak

Reputation: 4958

Triggering a system-wide garbage collection

I would like to know whether it is possible to trigger a system-wide garbage collection from a privileged system service in the Android Framework? I was thinking of something like a specialized signal that once trapped by the process running the dalvik VM will do a garbage collection in-place. Another alternative would be an API for AcitivityManager (or some other system service).

Upvotes: 0

Views: 140

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007286

There is certainly nothing documented or supported for this.

If anything, I would expect them to have logic to prevent GC from occurring on 2+ processes at once. Triggering an immediate GC in all Dalvik processes would grind the device to a halt, particularly on single-core devices, as a couple of dozen processes all try to do GC at once.

Of course, you are welcome to download the Android source code, modify it to suit, and deploy a ROM mod with your changes on devices that you control.

Upvotes: 2

Related Questions