summaryrefslogtreecommitdiffstats
path: root/runtime/gc/collector/mark_sweep.cc
Commit message (Collapse)AuthorAgeFilesLines
* More advanced timing loggers.Mathieu Chartier2014-06-241-81/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new timing loggers have lower overhead since they only push into a vector. The new format has two types, a start timing and a stop timing. You can thing of these as brackets associated with a timestamp. It uses these to construct various statistics when needed, such as: Total time, exclusive time, and nesting depth. Changed PrettyDuration to have a default of 3 digits after the decimal point. Exaple of a GC dump with exclusive / total times and indenting: I/art (23546): GC iteration timing logger [Exclusive time] [Total time] I/art (23546): 0ms InitializePhase I/art (23546): 0.305ms/167.746ms MarkingPhase I/art (23546): 0ms BindBitmaps I/art (23546): 0ms FindDefaultSpaceBitmap I/art (23546): 0ms/1.709ms ProcessCards I/art (23546): 0.183ms ImageModUnionClearCards I/art (23546): 0.916ms ZygoteModUnionClearCards I/art (23546): 0.610ms AllocSpaceClearCards I/art (23546): 1.373ms AllocSpaceClearCards I/art (23546): 0.305ms/6.318ms MarkRoots I/art (23546): 2.106ms MarkRootsCheckpoint I/art (23546): 0.153ms MarkNonThreadRoots I/art (23546): 4.287ms MarkConcurrentRoots I/art (23546): 43.461ms UpdateAndMarkImageModUnionTable I/art (23546): 0ms/112.712ms RecursiveMark I/art (23546): 112.712ms ProcessMarkStack I/art (23546): 0.610ms/2.777ms PreCleanCards I/art (23546): 0.305ms/0.855ms ProcessCards I/art (23546): 0.153ms ImageModUnionClearCards I/art (23546): 0.610ms ZygoteModUnionClearCards I/art (23546): 0.610ms AllocSpaceClearCards I/art (23546): 0.549ms AllocSpaceClearCards I/art (23546): 0.549ms MarkRootsCheckpoint I/art (23546): 0.610ms MarkNonThreadRoots I/art (23546): 0ms MarkConcurrentRoots I/art (23546): 0.610ms ScanGrayImageSpaceObjects I/art (23546): 0.305ms ScanGrayZygoteSpaceObjects I/art (23546): 0.305ms ScanGrayAllocSpaceObjects I/art (23546): 1.129ms ScanGrayAllocSpaceObjects I/art (23546): 0ms ProcessMarkStack I/art (23546): 0ms/0.977ms (Paused)PausePhase I/art (23546): 0.244ms ReMarkRoots I/art (23546): 0.672ms (Paused)ScanGrayObjects I/art (23546): 0ms (Paused)ProcessMarkStack I/art (23546): 0ms/0.610ms SwapStacks I/art (23546): 0.610ms RevokeAllThreadLocalAllocationStacks I/art (23546): 0ms PreSweepingGcVerification I/art (23546): 0ms/10.621ms ReclaimPhase I/art (23546): 0.610ms/0.702ms ProcessReferences I/art (23546): 0.214ms/0.641ms EnqueueFinalizerReferences I/art (23546): 0.427ms ProcessMarkStack I/art (23546): 0.488ms SweepSystemWeaks I/art (23546): 0.824ms/9.400ms Sweep I/art (23546): 0ms SweepMallocSpace I/art (23546): 0.214ms SweepZygoteSpace I/art (23546): 0.122ms SweepMallocSpace I/art (23546): 6.226ms SweepMallocSpace I/art (23546): 0ms SweepMallocSpace I/art (23546): 2.144ms SweepLargeObjects I/art (23546): 0.305ms SwapBitmaps I/art (23546): 0ms UnBindBitmaps I/art (23546): 0.275ms FinishPhase I/art (23546): GC iteration timing logger: end, 178.971ms Change-Id: Ia55b65609468f212b3cd65cda66b843da42be645
* Shared single GC iteration accounting for all GCs.Mathieu Chartier2014-06-201-90/+72
| | | | | | | | | | | | Previously, each garbage collector had data that was only used during collection. Since only one collector can be running at any given time, we can make this data be shared between all collectors. This reduces memory usage since we don't need to have redundant information for each GC types. Also reduced how much code is required to sweep spaces. Bug: 9969166 Change-Id: I31caf0ee4d572f75e0c66863fe7db12c08ae08e7
* Add mark compact collector.Mathieu Chartier2014-06-191-6/+1
| | | | | | | | | | | | | | | | | | | | | | The mark compact collector is a 4 phase collection, doing a normal full mark_sweep, calculating forwarding addresses of objects in the from space, updating references of objects in the from space, and moving the objects in the from space. Support is diabled by default since it needs to have non movable classes and field arrays. Performance numbers is around 50% as fast. The main advantage that this has over semispace is that the worst case memory usage is 50% since we only need one space isntead of two. TODO: Make field arrays and classes movable. This causes complication since Object::VisitReferences relies on these, so if we update the fields of an object but another future object uses this object to figure out what fields are reference fields it doesn't work. Bug: 14059466 Change-Id: I661ed3b71ad4dde124ef80312c95696b4a5665a1
* Change reference processing to use heap references.Mathieu Chartier2014-06-161-3/+8
| | | | | | | Removes several SetReferents for updating moved referents. Cleaned up other aspects of the code. Change-Id: Ibcb4d713fadea617efee7e936352ddf77ff4c370
* Remove deprecated WITH_HOST_DALVIK.Ian Rogers2014-06-101-3/+1
| | | | | | | | | | | | | | | | | | | | | | | Bug: 13751317 Fix the Mac build: - disable x86 selector removal that causes OS/X 10.9 kernel panics, - madvise don't need does zero memory on the Mac, factor into MemMap routine, - switch to the elf.h in elfutils to avoid Linux kernel dependencies, - we can't rely on exclusive_owner_ being available from other pthread libraries so maintain our own when futexes aren't available (we can't rely on the OS/X 10.8 hack any more), - fix symbol naming in assembly code, - work around C library differences, - disable backtrace in DumpNativeStack to avoid a broken libbacktrace dependency, - disable main thread signal handling logic, - align the stack in stub_test, - use $(HOST_SHLIB_SUFFIX) rather than .so in host make file variables. Not all host tests are passing on the Mac with this change. dex2oat works as does running HelloWorld. Change-Id: I5a232aedfb2028524d49daa6397a8e60f3ee40d3
* Use a heap allocated free buffer in MarkSweep::SweepArray().Hiroshi Yamauchi2014-05-281-1/+13
| | | | | | | This is for avoiding a large stack frame size. Bug: 15278350 Change-Id: I63e92c2dd0ad7078fd74ee2392717dc44b431e9a
* Begin migration of art::Atomic to std::atomic.Ian Rogers2014-05-201-25/+31
| | | | Change-Id: I4858d9cbed95e5ca560956b9dabd976cebe68333
* Add Handle/HandleScope and delete SirtRef.Mathieu Chartier2014-05-131-2/+2
| | | | | | | | | | | | | | | | Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
* Add null check in MarkSweepMarkObjectSlowPath.Mathieu Chartier2014-05-091-1/+1
| | | | | Bug: 14626564 Change-Id: Ief387e96b813440a35a7c480897576d1543891f6
* Add concurrent reference processing.Mathieu Chartier2014-05-071-17/+12
| | | | | | | | | | | | | | | | | Concurrent reference processing currently works by going into native code from java.lang.ref.Reference.get(). From there, we have a fast path if the references aren't being processed which returns the referent without needing to access any locks. In the slow path we block until reference processing is complete. It may be possible to improve the slow path if the referent is blackened. TODO: Investigate doing the fast path in java code by using racy reads of a static volatile boolean. This will work as long as there are no suspend points inbetween the boolean read and referent read. Bug: 14381653 Change-Id: I1546b55be4691fe4ff4aa6d857b234cce7187d87
* Add RecordFree to the GarbageCollector interfaceMathieu Chartier2014-05-051-13/+6
| | | | | | | RecordFree now calls the Heap::RecordFree as well as updates the garbage collector's internal bytes freed accounting. Change-Id: I8cb03748b0768e3c8c50ea709572960e6e4ad219
* Force inlining on trivial accessors.Ian Rogers2014-04-291-2/+2
| | | | | | | | | Make volatility for GetFieldObject a template parameter. Move some trivial mirror::String routines to a -inl.h. Bug: 14285442 Change-Id: Ie23b11d4f18cb15a62c3bbb42837a8aaf6b68f92
* Enable concurrent sweeping for non-concurrent GC.Mathieu Chartier2014-04-291-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the GarbageCollector to let all of the phases be run by the collector's RunPhases virtual method. This lets the GC decide which phases should be concurrent and reduces how much baked in GC logic resides in GarbageCollector. Enabled concurrent sweeping in the semi space and non concurrent mark sweep GCs. Changed the semi-space collector to have a swap semi spaces boolean which can be changed with a setter. Fixed tests to pass with GSS collector, there was an error related to the large object space limit. Before (EvaluateAndApplyChanges): GSS paused GC time 7.81s/7.81s, score: 3920 After (EvaluateAndApplyChanges): GSS paused GC time 6.94s/7.71s, score: 3900 Benchmark score doesn't go up since the GC happens in the allocating thread. There is a slight reduction in pause times experienced by other threads (0.8s total). Added options for pre sweeping GC heap verification and pre sweeping rosalloc verification. Bug: 14226004 Bug: 14250892 Bug: 14386356 Change-Id: Ib557d0590c1ed82a639d0f0281ba67cf8cae938c
* Always log explicit GC.Mathieu Chartier2014-04-281-1/+0
| | | | | | | | People who use DDMS want to see that a GC actually occurs when they press GC button. Bug: 14325353 Change-Id: I44e0450c92abf7223d33552ed37f626fe63e1c28
* Replace ObjectSet with LargeObjectBitmap.Mathieu Chartier2014-04-171-78/+65
| | | | | | | | | | | | | | | | | | | | | | | Speeds up large object marking since large objects no longer required a lock. Changed the GCs to use the heap bitmap for marking objects which aren't in the fast path. This eliminates the need for a MarkLargeObject function. Maps before (10 GC iterations): Mean partial time: 180ms Mean sticky time: 151ms Maps after: Mean partial time: 161ms Mean sticky time: 101ms Note: the GC durations are long due to recent ergonomic changes and because the fast bulk free hasn't yet been enabled. Over 50% of the GC time is spent in RosAllocSpace::FreeList. Bug: 13571028 Change-Id: Id8f94718aeaa13052672ccbae1e8edf77d653f62
* Refactor space bitmap to support different alignments.Mathieu Chartier2014-04-141-12/+12
| | | | | | | | | | | Required for: Using space bitmaps instead of std::set in mod union table + remembered set. Using a bitmap instead of set for large object marking. Bug: 13571028 Change-Id: Id024e9563d4ca4278f79607cdb2f81895121b113
* GSS: Fix the bump pointer space only collection.Hiroshi Yamauchi2014-04-081-1/+4
| | | | | | | | | | | | | | | | | | | Fixes b/13912464 where the clear soft reference behavior accidentally disabled the bump pointer space only collection. Changed the collector name so that the GC logs would indicate the generational mode and the collection mode. Peformance enhancement: instead of triggering the whole heap collection every 5 collections, count the bytes promoted since the last whole heap collection and use it to decide when to trigger the whole heap collection. This improves MemAllocTest by 5-10% (N4 and host). Bug: 13912464 Bug: 11650816 Bug: 9986565 Change-Id: I653a0dca62a8b54adf69abe2940a41eac70f809b
* Improve invalid root dumping.Mathieu Chartier2014-04-041-7/+8
| | | | | | The invalid root dumping now attempts to print the root type. Change-Id: Ie821296d569f34909ba6e2705f5c347cd2143a3a
* Make the support code for read barriers a bit more general.Hiroshi Yamauchi2014-03-311-6/+6
| | | | | | | Add an option for Baker in addition to Brooks. Bug: 12687968 Change-Id: I8a31db817ff6686c72951b6534f588228e270b11
* Swap allocation stacks in pause.Mathieu Chartier2014-03-281-115/+48
| | | | | | | | | | | | | | | | | This enables us to collect objects allocated during the GC for both sticky, partial, and full GC. This also significantly simplifies GC code. No measured performance impact on benchmarks, but this should slightly increase sticky GC throughput. Changed RevokeRosAllocThreadLocalBuffers to happen at most once per GC. Previously it occured twice if pre-cleaning was enabled. Renamed HandleDirtyObjectsPhase to PausePhase and enabled it for non-concurrent GC. This helps reduce duplicated code which was in both HandleDirtyObjectsPhase for concurrent GC and ReclaimPhase for non-concurrent GC. Change-Id: I533414b5c2cd2800f00724418e0ff90e7fdb0252
* Refactor some GC code.Mathieu Chartier2014-03-281-50/+19
| | | | | | | | Reduced amount of code in mark sweep / semi space by moving common logic to garbage_collector.cc. Cleaned up mod union tables and deleted an unused implementation. Change-Id: I4bcc6ba41afd96d230cfbaf4d6636f37c52e37ea
* Refactor object reference visiting logic.Mathieu Chartier2014-03-241-33/+70
| | | | | | | Refactored the reference visiting logic to be in mirror::Object instead of MarkSweep. Change-Id: I773249478dc463d83b465e85c2402320488577c0
* Refactor and optimize GC code.Mathieu Chartier2014-03-241-92/+81
| | | | | | | | | | | | | | | | | | | | Fixed the reference cache mod union table, and re-enabled it by default. Added a boolean flag to count how many null objects, immune, fast path, slow path objects we marked. Slight speedup in mark stack processing, large speedup in image mod union table scanning. EvaluateAndApplyChanges Before: Process mark stack time for full GC only: 12.464089s, 12.357870s, 12.538028s Time spent marking mod image union table ~240ms. After: Process mark stack time: 12.299375s, 12.217142s, 12.187076s Time spent marking mod image union table ~40ms. TODO: Refactor reference visiting logic into mirror::Object. Change-Id: I91889ded9d3f2bf127bc0051c1b1ff77e792e94f
* Revoke rosalloc thread-local buffers at the checkpoint.Hiroshi Yamauchi2014-03-211-0/+20
| | | | | | | | | | | | | | In the mark sweep collector, rosalloc thread-local buffers were revoked during the pause. Now, they are revoked at the thread checkpoint, as opposed to during the pause, which appears to help reduce the pause time. In Ritz MemAllocTest, the average sticky pause time went down ~20% (925 us -> 724 us). Bug: 13394464 Bug: 9986565 Change-Id: I104992a11b46d59264c0b9aa2db82b1ccf2826bc
* Merge "Refactor the garbage collector driver (GarbageCollector::Run)."Hiroshi Yamauchi2014-03-211-6/+1
|\
| * Refactor the garbage collector driver (GarbageCollector::Run).Hiroshi Yamauchi2014-03-201-6/+1
| | | | | | | | | | | | Bug: 12687968 Change-Id: Ifc9ee86249f7938f51495ea1498cf0f7853a27e8
* | Fix RecordFree to take signed parameters.Mathieu Chartier2014-03-201-9/+9
|/ | | | | | | | | | RecordFree can get negative bytes allocated when background compaction foreground transitions occur. This caused a DCHECK to fail on debug builds. Also did some refactoring in PreProcessReferences. Bug: 13568814 Change-Id: I57543f1c78544a94f1d241459698b736dba8cfa8
* Add soft reference pre processing.Mathieu Chartier2014-03-201-0/+11
| | | | | | | | | | | | | | | | | Soft reference pre-processing does soft reference preservation with mutators running. After this is done, it does another pass with mutators paused in the ProcessReference code. This helps lower pauses since most preserved soft references have their referents recursive marked outside the pause. Changed ergonomics to have non sticky collectors always clear the soft references. Maps pauses ~10ms -> ~3ms on Nexus 4. Bug: 13421927 Change-Id: I1370f7bb6934034869aa5afca0c377876267aa8e
* Use the card table to speed up the GSS collector.Hiroshi Yamauchi2014-03-141-2/+2
| | | | | | | | | | | | | Scan only dirty cards, as opposed to the whole space, to find references from the non-moving spaces to the bump pointer spaces at bump pointer space only collections. With this change, the Ritz MemAllocTest speeds up by 8-10% on host and 2-3% on N4. The Ritz EvaluateFibonacci speeds up by 8% and its average pause time is reduced by 43% on N4. Bug: 11650816 Change-Id: I1eefe75776bc37e24673b301ffa65a25f9bd4cde
* Refactor reference code into mirror namespace.Mathieu Chartier2014-03-141-3/+2
| | | | | | Added two new files: mirror/reference.h and mirror/reference-inl.h. Change-Id: Ibe3ff6379aef7096ff130594535b7f7c0b7dabce
* Refactor immune region logic into its own file.Mathieu Chartier2014-03-131-53/+9
| | | | | | | | Added immune_region.cc/.h in the collector directory. Changed the functionality to no longer assume spaces are added to immune region in ascending order. Change-Id: Id1d643b3849ad2695e8a151dbbb74a5035644472
* Defer heap transitions to heap trimming daemon.Mathieu Chartier2014-03-061-3/+0
| | | | | | | This fixes the case where quick back and forth process state changes would cause a lot of heap transitions. Change-Id: Ia5be792edcf26079b2aa23b9c115f6b0a9a39a1c
* Avoid marking old class linker and intern table roots during pause.Mathieu Chartier2014-03-041-25/+35
| | | | | | | | | | | | | | | | | | | | The new root visiting logic has a concept of a root log which holds new roots which were added since the start of the GC. This is an optimization since it lets us only mark these newly added roots during the pause (or pre-cleaning) since the other roots intern table and class linker roots were marked concurrently at the start of the GC. Before (EvaluateAndApplyChanges): MarkConcurrentRoots: Sum: 605.193ms After: MarkConcurrentRoots: Sum: 271.858ms This should also reduce pathological GC pauses which used to be able to happen when the intern table or class linker became "dirty" during the concurrent GC. Change-Id: I433fab021f2c339d50c35aaae7161a50a0901dec
* Fix clang to compile and run host tests.Ian Rogers2014-02-281-1/+1
| | | | | | | | | | | | | | Don't use the computed goto interpreter with clang 3.4 as it causes compilation to hang. Avoid inclusion of LLVM_(HOST|DEVICE)_BUILD_MK except for with portable as it sets clang incompatible cflags. Most fixes are self-evident, for the quick dex file method inliner the enums were being used with ostreams, so fix the enums and operator out python script to allow this. Note this change effects portable but this is untestable as portable was broken by ELF file and mc linker changes. Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
* Merge "(Experimental) Add Brooks pointers."Hiroshi Yamauchi2014-02-261-0/+16
|\
| * (Experimental) Add Brooks pointers.Hiroshi Yamauchi2014-02-251-0/+16
| | | | | | | | | | | | | | | | | | This feature is disabled by default. Verified that the Brooks pointers are installed correctly by using the CMS/SS collectors. Change-Id: Ia9be9814ab6e29169ac85edc4792ce8c81d552a9
* | Remove duplicate card pre-cleaning.Mathieu Chartier2014-02-251-15/+26
|/ | | | | | | Sticky GC was pre-cleaning cards twice since MarkingPhase calls MarkReachableObjects. Change-Id: I61572b79c855bcd02085a1f7ff96dd0089db95fb
* Remove started runtime check in RevokeAllThreadLocalAllocationStacksMathieu Chartier2014-02-251-4/+9
| | | | | | | | | | This check occasionally caused some thread local allocation stacks to incorrectly not get revoked when multiple threads were allocating without a started runtime. This showed up in image_test with compaction enabled when we were initializing classes in the compiler driver. Change-Id: I7f28d072feea333c2503e35265ba25c51a6308fe
* Card pre-cleaning.Mathieu Chartier2014-02-241-14/+40
| | | | | | | | | | | | | | | | | | | | | | | We now pre-clean cards before the pause in the concurrent mark sweep collectors. This provides substantial a pause time reduction for GC iterations which have a lot of dirty cards. The only downside is a slight GC time increase for large heaps. Benchmark FormulaEvaluationActions.EvaluateAndApplyChanges: Before: Partial average pause: 5.47ms Sticky average pause: 2.91ms Total GC time: 25.8s After: Partial average pause: 1.98ms Sticky average pause: 1.66ms Total GC time: 27.0s Benchmark score difference in the noise. Change-Id: If9f01f8c1501f122e19432438108d48e723b332e
* Fix and optimize verify object.Mathieu Chartier2014-02-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VerifyObject no longer resides in heap. You can now enable VerifyObject for non-debug builds. VerifyStack is still slow, so it is now guarded by its own flag. Fixed the image writer to not use verification at places where verification fails due to invalid reads. Fixed RosAlloc to use SizeOf which doesn't call verify object. Added a flag paremeter to some of the mirror getters / setters to be able to selectively disable VerifyObject on certain calls. Optimized the GC to not verify each object multiple times during object scanning if verify object is enabled. Added 3 verification options: verify reads, verify this, and verify writes so that you can select how much verification you want for mirror getters and setters. Removed some useless DCHECKs which would slow debug builds without providing any benefits. TODO: RosAlloc verification doesn't currently work with verify objects. Bug: 12934910 Bug: 12879358 Change-Id: Ic61033104dfc334543f89b0fc0ad8cd4f4015d69
* Change ProcessReferences to not use RecursiveMarkObject.Mathieu Chartier2014-02-201-13/+10
| | | | | | | | | | | | | | | | | | Calling ProcessMarkStack in RecursiveMarkObject caused a lot of overhead due to timing logger splits. Changed the logic to be the same as prior to the reference queue refactoring which involves calling process mark stack after preserving soft references and enqueueing finalizer references. FinalizingGC longest pause is reduced by around 1/2 down to ~300ms. Benchmark score ~400000 -> ~600000. Also changed the timing logger splits in the GC to have (Paused) if the split is a paused part of the GC. Bug: 12129382 Change-Id: I7476d4f23670b19d70738e2fd48e37ec2f57e9f4
* Change root visitor to use Object**.Mathieu Chartier2014-02-181-9/+14
| | | | | | | Simplifies code and improves the performance of root visiting since we usually don't need to check to see if the object moved. Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
* Thread-local allocation stack.Hiroshi Yamauchi2014-02-131-1/+17
| | | | | | | With this change, Ritz MemAllocTest gets ~14% faster on N4. Bug: 9986565 Change-Id: I2fb7d6f7c5daa63dd4fc73ba739e6ae4ed820617
* Add root types and thread id to root visiting.Mathieu Chartier2014-02-111-3/+5
| | | | | | | Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
* Add zygote space as its own space type.Mathieu Chartier2014-01-311-49/+10
| | | | | | | | | Helps prevent errors caused from doing invalid operations on the old alloc space. Removed some duplicated code in mark_sweep.cc and semi_space.cc. Change-Id: I67a772cab30d698744c918aad581053f282a4a99
* Refactor large object sweeping.Mathieu Chartier2014-01-101-18/+4
| | | | | | | Moved basic sweeping logic into large_object_space.cc. Renamed SpaceSetMap -> ObjectSet. Change-Id: I938c1f29f69b0682350347da2bd5de021c0e0224
* Background compaction support.Mathieu Chartier2014-01-081-47/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the process state changes to a state which does not perceives jank, we copy from the main free-list backed allocation space to the bump pointer space and enable the semispace allocator. When we transition back to foreground, we copy back to a free-list backed space. Create a seperate non-moving space which only holds non-movable objects. This enables us to quickly wipe the current alloc space (DlMalloc / RosAlloc) when we transition to background. Added multiple alloc space support to the sticky mark sweep GC. Added a -XX:BackgroundGC option which lets you specify which GC to use for background apps. Passing in -XX:BackgroundGC=SS makes the heap compact the heap for apps which do not perceive jank. Results: Simple background foreground test: 0. Reboot phone, unlock. 1. Open browser, click on home. 2. Open calculator, click on home. 3. Open calendar, click on home. 4. Open camera, click on home. 5. Open clock, click on home. 6. adb shell dumpsys meminfo PSS Normal ART: Sample 1: 88468 kB: Dalvik 3188 kB: Dalvik Other Sample 2: 81125 kB: Dalvik 3080 kB: Dalvik Other PSS Dalvik: Total PSS by category: Sample 1: 81033 kB: Dalvik 27787 kB: Dalvik Other Sample 2: 81901 kB: Dalvik 28869 kB: Dalvik Other PSS ART + Background Compaction: Sample 1: 71014 kB: Dalvik 1412 kB: Dalvik Other Sample 2: 73859 kB: Dalvik 1400 kB: Dalvik Other Dalvik other reduction can be explained by less deep allocation stacks / less live bitmaps / less dirty cards. TODO improvements: Recycle mem-maps which are unused in the current state. Not hardcode 64 MB capacity of non movable space (avoid returning linear alloc nightmares). Figure out ways to deal with low virtual address memory problems. Bug: 8981901 Change-Id: Ib235d03f45548ffc08a06b8ae57bf5bada49d6f3
* Refactor sweeping logic into malloc space.Mathieu Chartier2014-01-071-161/+10
| | | | | | | | | Removes duplicated code in MarkSweep/SemiSpace. Deleted VerifyImageRoots since it had race conditions and is tested by pre/post GC heap verification. Change-Id: I9636359ff6adb3e93d56ce77a3e15299ed23dfd5
* Tidy up memory barriers.Ian Rogers2013-12-201-8/+8
| | | | Change-Id: I937ea93e6df1835ecfe2d4bb7d84c24fe7fc097b
* Don't rely on gcc extensionsBernhard Rosenkränzer2013-12-121-1/+1
| | | | | | | | | | | | | | Make the code more compatible with different compilers. clang doesn't allow extra static qualifiers on template specializations, const qualifiers on function types, or inline attributes on lambda functions, and is more picky about casting away constness with reinterpret_cast. These modifications are compatible with both gcc and clang. Change-Id: I739b10df2780bec537827a13679fd2bcc2cc7188 Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>