[Gc] Re: Re: What's difference in GC between Windows version and WinCE version?

Boehm, Hans hans.boehm at hp.com
Wed Oct 13 22:48:12 PDT 2010


> From: biosli
> 
> Hi,Ivan!
> 
> Ivan Maidanski <ivmai at ...> writes:
> 
> >
> > Hi!
> >
> > WinCE block allocation algorithm is a bit different from Win32.
> >
> > Try play with GC_FREE_SPACE_DIVISOR and GC_INITIAL_HEAP_SIZE.
> >
> 
> Thanks a lot.
> I set GC_FREE_SPACE_DIVISOR as 100, and GC_INITIAL_HEAP_SIZE as
> 5*1024*1024, the
> program runs with less heap size than default value.
> But memory is not release as Windows version.
> In Windows version, I release used memory by GC_Free, it will move out
> form
> "Blocks in use" immediately. In WinCE version, it's not.
> So there are some further question, in WinCE version:
> 1. When heap size increace as a large size, the used memory in "Blocks
> in use"
> seems "locked", it will not return to "Free blocks".
> 	 Is that means GC break?
You are calling GC_free on large (> HBLKSIZE/2) blocks or small ones?  In the large case, you should be able to step through GC_free and see it call GC_freehblk, which should immediately put the object back on the freelist.  In the small object case, there may be a bogus reference to one of the objects on the page/block, which could prevent that large block from being deallocated, though most of it should still be available for further small object allocations.
> 
> 2. I calls GC_dump() at program exit, I finds the lines, as following:
> ---------------------------------------------------------------
> Free list 53:
> 	01580000 size 208896 start black listed
> 	01540000 size 208896 start black listed
> 	01500000 size 204800 start black listed
> 	014C0000 size 204800 start black listed
> ...............
> Free list 60:
> 	013E0400 size 570368 partially black listed
> 	00A30000 size 282624 partially black listed
> 	00C50400 size 303104 partially black listed
> ---------------------------------------------------------------
> What are "start black listed" are "partially black listed" means?
> Should I fix something makes it as "not black listed"?
A particular page is black-listed if the collector knows that there is a bogus reference pointing to it, so that, once allocated, it is unlikely to be reclaimed.  It avoids using such pages for large objects, or for objects that may point to a lot of memory.  Some of this is normal.  If a lot more of it is going on, it may mean the collector is tracing a lot of memory containing essentially random bit patterns, some of which look like pointers.   It may be that the WinCE collector is tracing memory it shouldn't be.

The collector also sometimes takes blocks that are consistently black-listed, allocates them as pointer-free memory, and drops them, so that it doesn't have to look at them again until the bogus reference goes away.  If you see lots of pointer-free blocks in the heap, with size of exactly one block, that may be an issue.
> 
> 3. Is there any other way, move out released memory form "Blocks in
> use"
> immediately? If this done, question 1 will never happen.
GC_free should do this for large blocks.  For smaller objects, it should put them directly on the small object free list.

Hans

> 
> Best regards.
> biosli
> 
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/



More information about the Gc mailing list