Why HeapBitmap.base pointer is alignment 4 KB?

by nari » Fri, 24 Jul 2009 12:32:52 GMT


Sponsored Links
 Hi.

I read GC of dalvikVM.
I had one question on the BitmapMarking.

--- start ---
/* file is dalvik/vm/alloc/HeapSource.c: addNewHeap() */
321:  static bool
322:  addNewHeap(HeapSource *hs, mspace *msp, size_t
mspAbsoluteMaxSize)
323:  {

/* snip */

355:      if (!dvmHeapBitmapInit(&heap.objectBitmap,
356:                             (void *)ALIGN_DOWN_TO_PAGE_SIZE
(heap.msp),
357:                             heap.absoluteMaxSize,
358:                             "objects"))
--- end ---

Why used ALIGN_DOWN_TO_PAGE_SIZE()? (at 356line)
Anybody knows who would be the best person can answer about the
matter?

I thought overnight, but I did not understand it. :(

---
Narihiro Nakamura

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Restoring the active Activity while resuming the application - sent again

Hello all,

I have two activities running: MainActivity and ChildActivity.
Whenever the user clicks in the button in MainActivity, the
ChildActivity is launched. What I want to do is this:

When the active activity is the ChildActivity and the user clicks the
home button then relaunch the application (like opening from the
beginning), I want to see the ChildActivity instead of MainActivity
that is launched. However; This is happening only when the user clicks
from recent activities window. (the window opened when you long press
the home button)

I had some suggestions actually work arounds and I tried to manipulate
onStart, onRestart, onResume, onStop, onDestroy events. But, they
didn't fully solve the problem. There should be a smart way out there.

By the way; I don't think my code has a specific problem to generate
this error/feature. Because, I created a test project and tried
standalone before sending the question and faced the same problem.
Anyhow, here is the test code. Thank you.

public class MainActivity extends Activity implements OnClickListener
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.setTitle("MainActivity");

        ((Button) findViewById
(R.id.btnChildActivity)).setOnClickListener(this);
    }

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        startActivity(new Intent(this, ChildActivity.class));
    }

}

public class ChildActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
        this.setTitle("ChildActivity");

    }
}


--~--~---------~--~----~------------~-------~--~----~

2. how to connect Android with Sqlite3.

Dear Group,
                     Actually i m working in an Android application on which
i want to connect the Android with Sqlite3.0.i wrote the code for connecting
that one,but not connected,plz help me....
-- 
Thanks and  Regards
Sharman Singh Sengar

--~--~---------~--~----~------------~-------~--~----~

3. Restoring the active Activity while resuming the application

4. Updating a built-in application - data preserved?

5. How to destroy an Activity in android

6. Modular resources under eclipse

7. How to get the original string data?