summaryrefslogtreecommitdiffstats
path: root/vm/alloc
Commit message (Collapse)AuthorAgeFilesLines
* Dalvik is dead, long live Dalvik!Brian Carlstrom2014-08-0531-9419/+0
| | | | | | | | | | | | | | | | | | | | | | | croot cd dalvik repo start dalvik-is-dead-long-live-dalvik . repo sync -c . git rm -r README.txt git rm -r dexopt git rm -r tools/deadcode.py git rm -r tools/dex-preopt git rm -r tools/dexcheck git rm -r tools/gdbjithelper git rm -r unit-tests git rm -r vm git checkout HEAD vm/Common.h (needed by libdex) git checkout HEAD vm/DalvikVersion.h (needed by libdex) git checkout HEAD vm/Profile.h (needed by dmtracedump) git add Android.mk (after removing vm, dexopt, and unit-tests references) git commit -a -m 'Dalvik is dead, long live Dalvik!' Bug: 14298175 Change-Id: I9dd13053677629d13496d4238af4374452cda415
* Add support for jemalloc.Christopher Ferris2014-05-142-1/+5
| | | | | | | | This is good enough to get dalvik to compile, but it still requires more work to make it really work. Bug: 981363 Change-Id: I411428a2e859c1f474fa0d7aaf406979bba9ed72
* Remove inconsistent usage of macros that broke Thread.sleep/wait on hostPaul Duffin2014-04-241-8/+1
| | | | | | | | | | | | | | | | | Code for managing Thread.sleep/wait used both !defined(__APPLE__) and HAVE_POSIX_CLOCKS interchangeably to mean the same thing. That worked when one or other was set but failed on host because neither were set and could also fail if they were both set. This changed to use HAVE_POSIX_CLOCKS consistently. The code that used this was spread across 4 separate files with quite a lot of duplication so that has been replaced with a new method dvmInitCondForTimedWait in Sync.cpp. A few extra comments were added to make some things that were a bit confusing clearer, hopefully. Change-Id: I7660c931f0cafcd0563afd1165de2aa615040602 Bug: https://code.google.com/p/android/issues/detail?id=68402
* Remove usage of pthread_cond_timedwait_monotonic_np.Narayan Kamath2014-03-041-0/+7
| | | | | | | | | Replaced with the posix compliant pthread_condattr_setclock. Unfortunately, mac OS doesn't support CLOCK_MONOTONIC or (pthread_condattr_setclock) so we fall back to using the "default" pthread_condattr_t value like we did earlier. Change-Id: I23475ef0d4e392d9e14402c6b5f8f658c5ed4063
* Merge "Use MAP_FIXED in remapNewHeap"Elliott Hughes2014-02-081-1/+1
|\
| * Use MAP_FIXED in remapNewHeapPete Delaney2014-01-091-1/+1
| | | | | | | | | | | | | | | | The heap address must not change when it is remapped Change-Id: Ia44f178932e2afe8de3d4739e7085caae8568885 Signed-off-by: Pete Delaney <piet.delaney@imgtec.com> Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
* | Let dalvik use <stdint.h> for SIZE_MAX.Elliott Hughes2014-01-241-2/+0
|/ | | | | Bug: 12708004 Change-Id: I96a167e1161d6350dfb97aff1c59d1ec39db9628
* Dalvik: Better compatibility with different compilersBernhard Rosenkränzer2013-12-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes building with clang 3.4, and possibly future versions of gcc: - Don't error out on unused functions generated by gen-mterp.py even when we're using -Werror - Eliminate some dead code (Word/kWordSize definition) clang warns about In order to avoid the need for -Wno-error=unused-function, gen-mterp.py would have to be a lot smarter than it currently is. Currently, it copies all code from header.cpp and then adds CPU specific routines. The code in header.cpp defines all sorts of functions that may or may not be used by the CPU specific routines, depending on whether or not the CPU specific bits have a better implementation available. To fix this without -Wno-error=unused-functions, gen-mterp.py would have to actually read the CPU specific bits and based on that throw out parts of header.cpp that aren't needed. This seems to be too much effort to just avoid having a couple of unused functions in the code that can be thrown out at compile time anyway, especially since this is in dalvik which will likely not see another major revision. Change-Id: I2874c6f05186721636518e422b0f39a3d8e731cd Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
* Merge commit 'b75a263239ff48c87b826f5d62a53c0efd22b507' into HEADThe Android Open Source Project2013-11-226-19/+227
|\ | | | | | | Change-Id: Ia37a6c18e09e6bbfab4beadc5ed86f92b766fe21
| * Fix native allocation tracking on Dalvik.Mathieu Chartier2013-08-232-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where we had inverted logic when checking for pending exceptions. Changed the logic to not update the native allocation watermarks after concurrent GC since the finalizers may not have been run at this point. Copied over the test from ART for ensuring that it is working. Bug: 10444866 Change-Id: Ie26170f9c4703f11e993233cdc9c5f46396fca84
| * Fix broken card table asserts.Mathieu Chartier2013-08-082-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had an off by one error due to getting the card for the heap source limit. This is not a valid card when the heap is at maximum size, but doesn't need to be since we do less than comparison on it. Fixed another error where we didn't take into account the biased begin in an assert. Did a bit of refactoring by removing useless if statement. Fixes 061-out-of-memory. Bug: 8282011 Change-Id: I66e3026e7b98b738ecfbced101846ec9f184ab70 (cherry picked from commit ee903e174872edd0ecc6f1940c7412892cd49123)
| * Show size/alloc/free per Dalvik heap space in dumpsysHiroshi Yamauchi2013-07-311-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Add the heap size/alloc/free stats to the Dalvik heap space breakdown section in dumpsys meminfo. Also, now the zygote heap has a distict ashmem region name. Bug: 9532137 Bug: 8266259 (cherry picked from commit 3edfe0b32753309ad7dcccd894239cb0a8aefb85) Change-Id: I9b32727e4211f571a5205b6b7281958514d245d4
| * Backport native allocation tracking.Mathieu Chartier2013-07-164-0/+123
| | | | | | | | | | | | | | From: https://googleplex-android-review.googlesource.com/#/c/328818/ Change-Id: I5a930e629c5a2062f01f870b4a44dcd98cb4ffe9
| * Add low memory mode option.Mathieu Chartier2013-07-133-18/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a low memory mode option which can be enabled by passing the flag "-XX:LowMemoryMode" to the VM. Changed dvmHeapSourceAlloc to use mspace_malloc and madvise page aligned regions of allocations back to the kernel if low memory mode is enabled. No measurable performance penalty on a benchmark which does 4 million object allocations. This seems to reduce the Dalvik total PSS by 10 - 15% on devices with large bitmaps (such as manta or flo). Another change is that cards are madvised instead of memset when cleared if low memory mode is enabled. This saves a minor amount of memory at the cost of having slightly more page faults. Change-Id: I0c850bc370ebabf4393bff1c47d3257b2f1518d2
* | Fix a couple of minor publicly-reported GC bugs.Elliott Hughes2013-10-292-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | An assertion was incorrectly assigning rather than testing, and there was the usual buggy attempt to recover from failure rather than just aborting in the HeapSource.cpp dvmHeapSourceStartup. (The Copying.cpp dvmHeapSourceStartup by contrast will just segfault if an allocation fails, but that's fine too.) Bug: https://code.google.com/p/android/issues/detail?id=61562 Bug: https://code.google.com/p/android/issues/detail?id=61563 Change-Id: I237a6f923a07d61709f99ab67c9a18dbc7e6c839
* | Fix broken card table asserts.Mathieu Chartier2013-08-082-13/+11
|/ | | | | | | | | | | | | | | | | | We had an off by one error due to getting the card for the heap source limit. This is not a valid card when the heap is at maximum size, but doesn't need to be since we do less than comparison on it. Fixed another error where we didn't take into account the biased begin in an assert. Did a bit of refactoring by removing useless if statement. Fixes 061-out-of-memory, 080-oom-throw. Bug: https://code.google.com/p/android/issues/detail?id=42868 (cherry picked from commit ee903e174872edd0ecc6f1940c7412892cd49123) Change-Id: If677c93e46fe1ee5729eec1820b1bd9682b4f924
* Add systrace tracing for GC and thread suspension.Jamie Gennis2013-05-071-0/+29
| | | | | Bug: 8856374 Change-Id: I58420a14fb52eab6295381a4d8f2d59eacfe0473
* Work around a dalvik JDWP/GC deadlock.Elliott Hughes2013-04-171-0/+8
| | | | | | | | | | | Also add a few missing TEMP_FAILURE_RETRYs that can cause dalvik to incorrectly decide that the debugger connection has been broken. Bug: 8191824 (cherry picked from commit b680ae3140a789f182c26abf8df9645f7744113a) Change-Id: I92736a1ad2f06caba30506d05bfa59fccbeee834
* fix DDMS crashTim Murray2013-01-141-0/+4
| | | | Change-Id: Ic5edd3d9367db8570523e1380c3e6edfabeec2c0
* Allow max free size of heap to be configured.Ian Rogers2012-09-242-19/+35
| | | | | | | | | This allows the max free to be larger on devices with more memory and thereby avoid GCs (that may be more frequent due to larger bitmaps). b/6606849 Change-Id: I4063a303ea4be3c1f227259d699fb238a806451f
* Remove unnecessary compiler pragma.Ian Rogers2012-08-292-5/+0
| | | | | | | | | | With dlmalloc 2.8.6 the compiler pragmas to suppress warnings are not necessary. Remove unnecessary dlmalloc dl prefix #define. Depends upon: https://android-review.googlesource.com/42351 Change-Id: Idc45cee9342efec0aab63d5172b3308a0fca3c4f
* Merge "Fix for 6994917 GC is slower since JOO33B per FrameworkPerf test"Ian Rogers2012-08-242-12/+10
|\
| * Fix for 6994917 GC is slower since JOO33B per FrameworkPerf testMathieu Chartier2012-08-232-12/+10
| | | | | | | | | | | | | | | | | | | | | | Fixes the GC aspect of the regression in FrameworkTest for Gc. Large bitmap test seems to be unaffected. Changes are: We now have minimum sleep of 1ms instead of 10ms in dvmSuspendAll. Some heuristics to avoid doing extra GCs if an allocation waited for a concurrent Gc. Change-Id: I3797c7dc813e26bd1f7bb0a9dbe55eb70dd1c9c9
* | Trim pre-Zygote fork, fix under-estimate of heap limit.Ian Rogers2012-08-223-3/+32
|/ | | | | | | | | | | | | | | | | | | Card scanning uses dvmHeapSourceGetValue to scan from the heap base to the total foot print of the heap. Trimming the Zygote may lower the footprint of the heap by creating a hole in the middle. This hole is unaccounted for in the card scanning leading to missed dirty cards. This was a regression introduced by: https://android-review.googlesource.com/#/c/41728/ as it didn't #define MORECORE_CANNOT_TRIM 1 that was previously defined here: https://android-review.googlesource.com/#/c/41731/4/libcutils/mspace.c Introduce a notion of dvmHeapSourceGetLimit so that card scanning doesn't rely on footprint. Trim the heap before forking the Zygote. This change continues to enable morecore trimming of mspaces. Change-Id: I3f0b12371097f50a1f920cac25846ca08685e7ed
* Upgrade to dlmalloc 2.8.5.Ian Rogers2012-08-207-202/+316
| | | | | | | | | | | | Switch to using dlmalloc 2.8.5. Define mspace functionality directly using dlmalloc rather than taking from libcutils. Remove growth limit check in tryMalloc that only checks initial growth limit. Implement trimming at the end of the mspace. Depends upon: https://android-review.googlesource.com/41717 Change-Id: Ia2c6b50bdb0b0d5aae4b18deefbd1bf50dfa49d5
* Don't log "WAIT_FOR_CONCURRENT_GC blocked 0ms".Elliott Hughes2012-07-161-1/+3
| | | | | | | Stupid to spend more time logging than we spent waiting. (Highly visible in the zygote's preloading phase.) Change-Id: If2d6b6093b3bebae0887aa385745b7ed9225216b
* am bf11122d: Merge "Revert " Trim after explicit gc.""Elliott Hughes2012-06-113-8/+3
|\ | | | | | | | | * commit 'bf11122d175d1315783b313897ee8ecae63f0278': Revert " Trim after explicit gc."
| * Revert " Trim after explicit gc."Elliott Hughes2012-06-113-8/+3
| | | | | | This reverts commit ea4c6e57a48e08eacbf08520c64133175e7d5da0
* | am 89cf125c: Report GC pause times more accurately.Jeff Brown2012-05-301-9/+16
|\ \ | | | | | | | | | | | | * commit '89cf125cd95a7df3a713cb3d3d39a033304e474c': Report GC pause times more accurately.
| * | Report GC pause times more accurately.Jeff Brown2012-05-301-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Include the time that it actually took to pause or suspend threads in the reported time. Also report the amount of time that other threads spend blocked waiting for a concurrent GC to complete. Change-Id: I80af351c2dc3171fc7db48dbbb361f3d92bbca80
| * | Fix: Issue 26627: Dalvik Heap Trim timer value after GCSangWook Han2012-05-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dvmRelativeCondWait need millisecods not seconds. With this fix, trim will begins 5 seconds after concurrent GC Bug: http://code.google.com/p/android/issues/detail?id=26627 Bug: 6482868 Change-Id: I3802b48e345725fb78e4ef2c999dd243ef30a138
* | | am 3492e8ab: Merge " Trim after explicit gc."Elliott Hughes2012-05-113-3/+8
|\ \ \ | | |/ | |/| | | | | | | * commit '3492e8ab5939ebdbec642ad284bce015937e60d9': Trim after explicit gc.
| * | Trim after explicit gc.SangWook Han2012-05-113-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Gingerbread, dvmHeapSourceTrim() is called 5 seconds after every kind of GC. Current AOSP do trim only for concurrent GC. That makes OOM killer too busy. At least explicit GC need trim and in case of explicit GC, there are no need to delay 5 seconds before trim. Change-Id: I8fde8f773398bf20c674cfa6f686d7d745d56492
* | | am 07cfd74d: Merge " Fix: Issue 26627: Dalvik Heap Trim timer value after GC"Elliott Hughes2012-05-111-3/+3
|\| | | |/ |/| | | | | * commit '07cfd74d766d821196fa2451604af25cfa9767de': Fix: Issue 26627: Dalvik Heap Trim timer value after GC
| * Fix: Issue 26627: Dalvik Heap Trim timer value after GCSangWook Han2012-05-111-3/+3
| | | | | | | | | | | | | | | | | | dvmRelativeCondWait need millisecods not seconds. With this fix, trim will begins 5 seconds after concurrent GC Bug: http://code.google.com/p/android/issues/detail?id=26627 Change-Id: I3802b48e345725fb78e4ef2c999dd243ef30a138
| * DO NOT MERGE Further refinement of card table clearAndy McFadden2011-11-091-7/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently using memset() to clear cards out to the growth limit, which on a device configured for 48MB/128MB process caps means we're sitting on 384KB or 1MB of pages. We can reduce that substantially. This change attempts to reduce the memset() length to the currently active portion of the card table, based on the placement of objects in the "live objects" bitmap. This should avoid faulting in card pages that we don't actually need. This is suboptimal when parts of the card table are used briefly and then ignored for a while. An alternative implementation, which uses madvise(DONTNEED) aggressively, is also included (#ifdefed out). Bug 5567332 (cherry-pick from master) Change-Id: I6b181de20a0c8b6307acaebbc5d6dac20422f25d
* | Replace malloc() followed by memset() to zero with calloc()Iliyan Malchev2012-02-162-10/+5
| | | | | | | | | | | | | | | | | | | | | | Bionic's calloc() is smart enough to not zero out memory if it gets that memory from an anonyous mmap. Thus, if we use malloc for large allocations, we cause unnecessary memory duplication by following the malloc() with a memset(). An even better approach would be to replace the known large calloc() calls with dvmAllocRegion() allocation. Change-Id: Id308f541c9a040d5929bf991b6c2bfdefb823c3c
* | Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-088-21/+21
| | | | | | | | | | | | | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Also fix an occurrence of LOGW missed in an earlier change. Bug: 5449033 Change-Id: I2e3b23839e6dcd09015d6402280e9300c75e3406
* | Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGESteve Block2012-01-064-7/+7
| | | | | | | | | | | | | | See https://android-git.corp.google.com/g/157065 Bug: 5449033 Change-Id: Ia5d301248024df26c2a29dabdfe738e39ec87c82
* | Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGESteve Block2012-01-052-14/+14
| | | | | | | | | | | | | | See https://android-git.corp.google.com/g/156801 Bug: 5449033 Change-Id: Ic558031c75b3702d90eb78bd730501ae5d3c077b
* | Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-034-7/+7
| | | | | | | | | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: Ic663376d1ad6a6cb14bf81405ad9afd247cf2f60
* | Further refinement of card table clearAndy McFadden2011-11-091-7/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently using memset() to clear cards out to the growth limit, which on a device configured for 48MB/128MB process caps means we're sitting on 384KB or 1MB of pages. We can reduce that substantially. This change attempts to reduce the memset() length to the currently active portion of the card table, based on the placement of objects in the "live objects" bitmap. This should avoid faulting in card pages that we don't actually need. This is suboptimal when parts of the card table are used briefly and then ignored for a while. An alternative implementation, which uses madvise(DONTNEED) aggressively, is also included (#ifdefed out). Bug 5567332 Change-Id: I7663ae7d15d0aaa8158deed5e331bf05333da6bb
* | Fix reporting of initial pause timeAndy McFadden2011-11-071-1/+1
| | | | | | | | | | | | | | | | | | The "rootEnd" time was being captured before dvmClearCardTable() was called. Bug 5567332 Change-Id: I5499f1648c3e41296c18fa5d95d834c2d2853e8f
* | am 4c83f214: Merge "Reduce Dalvik card table overhead" into ics-mr1Andy McFadden2011-11-055-4/+25
|\| | | | | | | | | * commit '4c83f214932af008cf79aee528ca3f9e66572040': Reduce Dalvik card table overhead
| * Reduce Dalvik card table overheadAndy McFadden2011-11-045-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VM has a "growth limit" (e.g. 48MB) that is used to cap normal apps, and a "max heap" (e.g. 128MB) that is used for apps with unusual high-memory requirements. The Dalvik GC uses a 128:1 "card table" that spans the entire managed heap, out to the "max heap" limit. The table is erased during every concurrent GC. The first time we do that post-zygote, the copy-on-write behavior causes physical pages to be allocated. We're currently clearing out to the heap max, not the growth limit, which means we have a bunch of physical memory allocated for pages that will never be used. This changes it so we only clear out to the growth limit. If the growth limit is removed by the app, we clear out to the heap max. On devices with a 128MB max heap, this reduces the private/dirty usage for most apps by 640KB. Bug 5567332 Change-Id: Iac633017c128d63b284d48016e47d40cc46df1de
* | Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2011-10-261-2/+2
| | | | | | | | | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I8bd96961e369a08e86ff78b82d90f20f42787eb1
* | Rename (IF_)LOG() to (IF_)ALOG() DO NOT MERGESteve Block2011-10-251-5/+5
|/ | | | | | | See https://android-git.corp.google.com/g/#/c/141576 Bug: 5449033 Change-Id: Ie3bc0d5436218ea05f98cb0373ecf5924f78db05
* Avoid deadlock.Elliott Hughes2011-10-142-5/+4
| | | | | | | | | | | | | | | | | | | dvmIsHeapAddress is the pointer validity checker for use outside the GC. If it doesn't take the heap lock, it risks looking at data structures that are changing under its feet. If it does take the heap lock, it risks deadlock between a thread doing an explicit GC and the signal catcher trying to dump threads (causing the GC thread to be suspended while holding the heap lock). Calling back into managed code while holding the heap lock and with other threads resumed sounds like an inherently bad idea to me, but that's a battle for another day. With this change, we can handle SIGQUIT while we're in ReferenceQueue.add as a result of an explicit GC in a system doing concurrent collections, so the only known problem is fixed. Bug: 5425802 Change-Id: I42d434d5ea3ffbcb77a4c544b81b08a4c7364a16
* Revert "Use the card table to scan the immune region of the heap."Ben Cheng2011-10-109-329/+117
| | | | | | | | | | | | | | | | | This reverts commit 6c355e53332502314c3d82a7afcf898d66118f27. Conflicts are resolved in: vm/alloc/CardTable.cpp vm/alloc/HeapBitmap.cpp vm/alloc/HeapInternal.h vm/alloc/HeapSource.cpp vm/alloc/MarkSweep.cpp Tested with overnight monkey runs + Delaunay. Bug: 5037417 Change-Id: I400eff8542d0bddd865ce570a479f7750c1ba484
* Take the heap lock in dvmIsHeapAddress.Elliott Hughes2011-08-101-1/+4
| | | | | Bug: 5049447 Change-Id: I9df6e4116efa44088d37ac0ff4455a7876535e1e