1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /* 17 * Internal heap functions 18 */ 19 #ifndef _DALVIK_ALLOC_HEAP 20 #define _DALVIK_ALLOC_HEAP 21 22 /* 23 * Initialize the GC heap. 24 * 25 * Returns true if successful, false otherwise. 26 */ 27 bool dvmHeapStartup(void); 28 29 /* 30 * Initialization that needs to wait until after leaving zygote mode. 31 * This needs to be called before the first allocation or GC that 32 * happens after forking. 33 */ 34 bool dvmHeapStartupAfterZygote(void); 35 36 /* 37 * Tear down the GC heap. 38 * 39 * Frees all memory allocated via dvmMalloc() as 40 * a side-effect. 41 */ 42 void dvmHeapShutdown(void); 43 44 #if 0 // needs to be in Alloc.h so debug code can find it. 45 /* 46 * Returns a number of bytes greater than or 47 * equal to the size of the named object in the heap. 48 * 49 * Specifically, it returns the size of the heap 50 * chunk which contains the object. 51 */ 52 size_t dvmObjectSizeInHeap(const Object *obj); 53 #endif 54 55 /* 56 * Run the garbage collector without doing any locking. 57 */ 58 void dvmCollectGarbageInternal(bool collectSoftReferences); 59 60 #endif // _DALVIK_ALLOC_HEAP 61