[Gc] Boehm GC and Iphone

Damian damian.pop at gmail.com
Sat Jan 29 17:23:03 PST 2011


Hi Ivan, could you find anything about it?

On Fri, Jan 21, 2011 at 12:24 AM, Damian <damian.pop at gmail.com> wrote:

> I'm sending you a very small test case attached. It has an xcode project
> too, with some automatically generated files, but the code is just this:
>
> void** trash;
>
> void runTest() {
>     GC_INIT();
>     GC_enable_incremental(); // REMOVING THIS LINE IT WONT CRASH
>      trash = GC_MALLOC(sizeof(void*));
>     while(1){
>         *trash = GC_MALLOC(16);
>     }
> }
>
> To build the GC I'm using the options: --host=arm-apple-darwin10
> --enable-cplusplus=no --enable-shared=no --enable-full-debug=no
> If it helps, I added the script I'm using to build it, it's
> named build-iphone.sh
> Hope it helps!
>
> Damian
>
> 2011/1/20 Ivan Maidanski <ivmai at mail.ru>
>
> Hello,
>>
>> Send the C/C++ code  as an attachment. And specify the building options
>> (or link the makefile as an attachment).
>>
>> Regards.
>>
>> Thu, 20 Jan 2011 18:23:45 -0300 Damian Troncoso <damian.pop at gmail.com>:
>>
>> > Sure I'll do. I can make an xcode project. Where should I upload it?
>> >
>> > El 20/01/2011, a las 17:54, Ivan Maidanski <ivmai at mail.ru> escribi?:
>> >
>> > > Hi,
>> > >
>> > > Would be nice if you provide a test case (as small as possible).
>> > >
>> > > Meanwhile, I'll run my app eating/recycling lots of memory on iphone
>> with
>> > enable incremental.
>> > >
>> > > Regards.
>> > >
>> > > Wed, 19 Jan 2011 20:34:43 -0300 Damian <damian.pop at gmail.com>:
>> > >
>> > >> I tried 3, 5 and 6 and nothing changed.
>> > >> Yes, I'm getting the abort on the first call to exc_server, and
>> > >> catch_exception_raise
>> > >> is never called.
>> > >>
>> > >> 2011/1/19 Ivan Maidanski <ivmai at mail.ru>
>> > >>
>> > >>> Hi,
>> > >>>
>> > >>> 1. Are you getting abort on the first exc_server call?
>> > >>> 2. Is catch_exception_raise called?
>> > >>> 3. Try BROKEN_EXCEPTION_HANDLING
>> > >>> 4. msgh_reserved is not set to any value, that's why it is random.
>> > >>> 5. For ID_STOP, ID_RESUME, it might be not safe to use 1, 2 - try
>> other
>> > >>> values.
>> > >>> 6. Try to increase reply/msg.data size in GC_mprotect_thread.
>> > >>>
>> > >>> Regards.
>> > >>>
>> > >>> Wed, 19 Jan 2011 00:23:26 -0300 Damian <damian.pop at gmail.com>:
>> > >>>
>> > >>>> Well I managed to debug the code.
>> > >>>> I really don't get why the exception is produced, I don't even know
>> if
>> > >>> the data passed to exc_server looks good or not.
>> > >>>> It's always like the following when the exception is thrown, the
>> only
>> > >>> value that changes is 'msgh_reserved':
>> > >>>
>> > >>>> (gdb) p msg.head</div>
>> > >>>> $1 = {
>> > >>>> msgh_bits = 2147488018,
>> > >>>> msgh_size = 76,
>> > >>>> msgh_remote_port = 6147,
>> > >>>> msgh_local_port = 4611,
>> > >>>> msgh_reserved = 3445996780,
>> > >>>> msgh_id = 2401
>> > >>>> }
>> > >>>
>> > >>>> The call to exc_server is like this:
>> > >>>
>> > >>>>
>> > >>>> if(!exc_server(&msg.head, &reply.head))
>> > >>>> ABORT("exc_server failed");
>> > >>>
>> > >>>> msg.head is filled with a call to mach_msg, like this:
>> > >>>
>> > >>>>
>> > >>>> r = mach_msg(&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE |
>> > >>>> (GC_mprotect_state == GC_MP_DISCARDING ? MACH_RCV_TIMEOUT : 0),
>> > >>>> 0, sizeof(msg), GC_ports.exception,
>> > >>>> GC_mprotect_state == GC_MP_DISCARDING ? 0
>> > >>>> : MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
>> > >>>
>> > >>>> I'm lost :(
>> > >>>> 2011/1/18 Ivan Maidanski <ivmai at mail.ru>
>> > >>>> Hi,
>> > >>>>
>> > >>>> Tue, 18 Jan 2011 03:24:33 -0300 Damian <damian.pop at gmail.com>:
>> > >>>>
>> > >>>
>> > >>>>> Hi Ivan, thanks for helping me with this.
>> > >>>>> 1. I defined none of those, should I define any? (I tried both
>> after I
>> > >>> read
>> > >>>>> this but I get the same exception)
>> > >>>>
>> > >>>> So, the problem is not there.
>> > >>>>
>> > >>>
>> > >>>>> 2. My app only runs on iphone, but I tried it in the iphone
>> simulator
>> > >>> and it
>> > >>>>> does not crash. I built the gc just like for the simulator but for
>> x86
>> > >>>>
>> > >>>>> arch and it seems to work.
>> > >>>>
>> > >>>>> 3. How? How do I build the collector with symbols on? I tried
>> adding -g
>> > >>> to
>> > >>>>> compiler options and I get a library more than twice bigger so I
>> thing
>> > >>> it
>> > >>>>> has the symbols, but when debugging the stack is the same.
>> > >>>>
>> > >>>> I don't know. At least, try to set a break point at exc_sever and
>> watch
>> > >>> what is passed to it.
>> > >>>>
>> > >>>> Regards.
>> > >>>>
>> > >>>
>> > >>>>>
>> > >>>>> Thanks again!
>> > >>>>> Damian
>> > >>>>>
>> > >>>>> 2011/1/17 Ivan Maidanski <ivmai at mail.ru>
>> > >>>>>
>> > >>>>>> Hi Damian,
>> > >>>>>>
>> > >>>>>> 1. Is the mode is GC_DISCOVER_TASK_THREADS or
>> > >>> GC_NO_THREADS_DISCOVERY?
>> > >>>>>> 2. Could you try your app on Mac OS X?
>> > >>>>>> 3. Could you debug with symbols on and tell us the reason of
>> abort
>> > >>> call?
>> > >>>>>> 4. GC_get_parallel() returns non-zero if 2 or more markers are
>> > >>> running.
>> > >>>>>> 5. Incremental/generation mode is turned on only if either
>> > >>>>>> GC_enable_incremental() is called (unless GC_DISABLE_INCREMENTAL
>> env
>> > >>> var is
>> > >>>>>> set) or GC_ENABLE_INCREMENTAL env var is set.
>> > >>>>>>
>> > >>>>>> Regards.
>> > >>>>>>
>> > >>>>>> Sun, 16 Jan 2011 01:18:05 -0300 Damian <damian.pop at gmail.com>:
>> > >>>>>>
>> > >>>>>>> Well, I was not calling gc_enable_incremental() so I think it
>> was
>> > >>> not
>> > >>>>>>> enabled.
>> > >>>>>>> Now I added the call but the program execution is aborted with
>> this
>> > >>> stack
>> > >>>>>>> trace:
>> > >>>>>>>
>> > >>>>>>> #0 0x31cbcffc in __abort ()
>> > >>>>>>>
>> > >>>>>>> #1 0x31cbd04c in abort ()
>> > >>>>>>>
>> > >>>>>>> #2 0x31c91fcc in internal_catch_exception_raise ()
>> > >>>>>>>
>> > >>>>>>> #3 0x31c81ea4 in _Xexception_raise ()
>> > >>>>>>>
>> > >>>>>>> #4 0x31c81ab0 in exc_server ()
>> > >>>>>>>
>> > >>>>>>> #5 0x00060f20 in GC_mprotect_thread ()
>> > >>>>>>>
>> > >>>>>>> #6 0x31caa284 in _pthread_start ()
>> > >>>>>>>
>> > >>>>>>> #7 0x31c9f2b0 in thread_start ()
>> > >>>>>>>
>> > >>>>>>>
>> > >>>>>>> Any help?
>> > >>>>>>> Thanks!
>> > >>>>>>>
>> > >>>>>>>
>> > >>>>>>> On Sat, Jan 15, 2011 at 8:14 PM, Damian <damian.pop at gmail.com>
>> > >>> wrote:
>> > >>>>>>>
>> > >>>>>>>> Hi, I've just built gc7.2 BDWGC for iphone device, and it's
>> > >>> working.
>> > >>>>>>>> How can I make sure that generation mode is on and working?
>> > >>>>>>>> And, parallel mark doesn't work on single core cpus?
>> > >>>>>>>>
>> > >>>>>>>> Damian.
>> > >>>>>>>>
>> > >>>>>>>> 2011/1/13 Ivan Maidanski <ivmai at mail.ru>
>> > >>>>>>>>
>> > >>>>>>>>> Hi,
>> > >>>>>>>>>
>> > >>>>>>>>> If the platform is not multi-core then parallel-mark mode
>> should
>> > >>> be
>> > >>>>>> off
>> > >>>>>>>>> (either at compile time or at runtime).
>> > >>>>>>>>> But turning on generation mode could reduce the GC pause on a
>> > >>>>>> single-core.
>> > >>>>>>>>>
>> > >>>>>>>>> Regards.
>> > >>>>>>>>>
>> > >>>>>>>>> Thu, 13 Jan 2011 08:28:55 -0300 Damian <damian.pop at gmail.com
>> >:
>> > >>>>>>>>>> None is multicore. Will I get an inprovement anyway?
>> > >>>>>>>>>> Ok, I will try to compile gc7.2 BDWGC snapshot tonight.
>> > >>>>>>>>>> Thanks!
>> > >>>>>>>>>>
>> > >>>>>>>>>> 2011/1/13 Ivan Maidanski <ivmai at mail.ru>
>> > >>>>>>>>>>
>> > >>>>>>>>>>> Hi,
>> > >>>>>>>>>>>
>> > >>>>>>>>>>> 1. Are you going to run it on a multi-core? (I don't know
>> > >>> Apples
>> > >>>>>>>>> devices
>> > >>>>>>>>>>> internals deeply, so I wonder which of them have multi-core
>> > >>> CPUs).
>> > >>>>>>>>>>>
>> > >>>>>>>>>>> 2. If you start using gc6.8 just because of the reason you
>> > >>>>>> mentioned,
>> > >>>>>>>>> I
>> > >>>>>>>>>>> recommend you to migrate to gc7.2 (get the recent BDWGC
>> > >>> snapshot
>> > >>>>>> which
>> > >>>>>>>>> now
>> > >>>>>>>>>>> has generation plus parallel collection enabled).
>> > >>>>>>>>>>>
>> > >>>>>>>>>>> 3. Incremental/generation collection as well as parallel
>> > >>> marking
>> > >>>>>> are
>> > >>>>>>>>> the GC
>> > >>>>>>>>>>> improvements aiming collection pause reduction.
>> > >>>>>>>>>>>
>> > >>>>>>>>>>> Regards.
>> > >>>>>>>>>>>
>> > >>>>>>>>>>> Wed, 12 Jan 2011 20:03:02 -0300 Damian <
>> > >>> damian.pop at gmail.com>:
>> > >>>>>>>>>>>
>> > >>>>>>>>>>>> Maybe concurrent + parallel collection does not what I'm
>> > >>>>>> expecting.
>> > >>>>>>>>>>>> What I need to achieve is to reduce the collection pause.
>> > >>>>>>>>>>>> I'm using version 6.8 (because I've found somewhere on the
>> > >>>>>> internet
>> > >>>>>>>>>>> someone
>> > >>>>>>>>>>>> has made it work on iphone with some changes) and I'm
>> > >>> having
>> > >>>>>>>>> collection
>> > >>>>>>>>>>>> cycles of about 120ms. I need to reduce that number. I
>> > >>> don't
>> > >>>>>> care if
>> > >>>>>>>>>>> overall
>> > >>>>>>>>>>>> collection time increases as long as the app is not
>> > >>> freezed for
>> > >>>>>> such
>> > >>>>>>>>> a
>> > >>>>>>>>>>> long
>> > >>>>>>>>>>>> time.
>> > >>>>>>>>>>>> Is that possible?
>> > >>>>>>>>>>>>
>> > >>>>>>>>>>>> Thanks.
>> > >>>>>>>>>>>>
>> > >>>>>>>>>>>> 2011/1/12 Ivan Maidanski <ivmai at mail.ru>
>> > >>>>>>>>>>>>
>> > >>>>>>>>>>>>> Hi,
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>> BTW What Apple devices has a multi-core CPU at present?
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>> I ran GC test on a single-core with GC_MARKERS=4 -
>> > >>> collector
>> > >>>>>>>>> appears to
>> > >>>>>>>>>>>>> work...
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>> Wed, 12 Jan 2011 10:04:00 -0300 Damian <
>> > >>> damian.pop at gmail.com
>> > >>>>>>> :
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>>> Hi,
>> > >>>>>>>>>>>>>> Is it possible to compile boehm gc for iphone enabling
>> > >>>>>>>>> generational
>> > >>>>>>>>>>> and
>> > >>>>>>>>>>>>> parallel collection?
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>> See the recent post by Hans.
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>> I try to enable generational collection on multi-cores
>> > >>>>>> (regardless
>> > >>>>>>>>>>> whether
>> > >>>>>>>>>>>>> this slows down the GC in average or not - anyway it is
>> > >>> not on
>> > >>>>>> by
>> > >>>>>>>>>>> default).
>> > >>>>>>>>>>>>> FYI: At present, generational collection on multi-cores
>> > >>>>>> enabled
>> > >>>>>>>>> only on
>> > >>>>>>>>>>>>> Win32.
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>> Regards.
>> > >>>>>>>>>>>>>
>> > >>>>>>>>>>>>>> I will try to do so; probably I will need help, but
>> > >>> for now
>> > >>>>>> al
>> > >>>>>>>>> least
>> > >>>>>>>>>>> I
>> > >>>>>>>>>>>>> want to know it it's possible at all.
>> > >>>>>>>>>>>>>> Thanks
>> > >>>>>>
>> > >>>>>>
>> > >>>>>
>> > >>>>
>> > >>>>> _______________________________________________
>> > >>>>> Gc mailing list
>> > >>>>> Gc at linux.hpl.hp.com
>> > >>>>> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>> > >>>>
>> > >>>>
>> > >>>> _______________________________________________
>> > >>>> Gc mailing list
>> > >>>> Gc at linux.hpl.hp.com
>> > >>>> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>> > >>>>
>> > >>>
>> > >>>
>> > >>
>> > >> _______________________________________________
>> > >> Gc mailing list
>> > >> Gc at linux.hpl.hp.com
>> > >> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>> > >
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20110129/362596b3/attachment-0001.htm


More information about the Gc mailing list