OSDN Git Service

Do not initiate a concurrent collection if one is already running.
authorCarl Shapiro <cshapiro@google.com>
Fri, 10 Jun 2011 06:45:49 +0000 (23:45 -0700)
committerCarl Shapiro <cshapiro@google.com>
Fri, 10 Jun 2011 06:45:55 +0000 (23:45 -0700)
commitfd31cc071c83bdbe45e6f9db41fd76375e7ac310
tree6589db14bddef7ffeb15fdab8448721e517681fc
parentc0ad55114857ec38000afd30b9fe60e7ea8e1398
Do not initiate a concurrent collection if one is already running.

It is possible to cause a recursive garbage collection by writing a
program that triggers a concurrent garbage collection and initiates a
concurrent garbage collection before the garbage collection thread is
scheduled.  For example

  for (;;) { new byte[16 << 20]; System.gc(); }

When this condition occurs a warning is logged although such warnings
ought to be upgraded to fatal errors.  With this change, when the
garbage collection thread is scheduled it first checks to see if there
is a running collection before calling down to start the collection.

Change-Id: Ia7baf5eba245bbf3fe053d3bad3f90876cad2459
vm/alloc/HeapSource.cpp