This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
arm-wince-pe-gcj: Finalizers not getting called
- From: "Craig A. Vanderborgh" <craigv at voxware dot com>
- To: java at gcc dot gnu dot org
- Date: 29 Jul 2003 10:58:05 -0600
- Subject: arm-wince-pe-gcj: Finalizers not getting called
Hello All:
After an excruciating week we have finally tracked down a very bad
problem with our arm-wince-pe port of gcj/boehm/libgcj.
We are leaking synchronization objects big-time. In fact, every call to
"new" appears to leak a M$ CRITICAL_SECTION. The resulting leak is not
in the process address space but CE kernel pages are leaked.
The problem turns out to be rather simple. InitializeCriticalSection,
the M$ call that creates the CRITICAL_SECTION is being called, and
DeleteCriticalSection is NOT being called. Not even once. The
finalizer appears to be getting defined and registered, vis:
00297508 <__Z18finalize_sync_infoPN4java4lang6ObjectE>:
297508: e92d4030 stmdb sp!, {r4, r5, lr}
29750c: e1a04000 mov r4, r0
297510: e3a05000 mov r5, #0 ; 0x0
297514: e280002c add r0, r0, #44 ; 0x2c
297518: e5845024 str r5, [r4, #36]
29751c: e5845028 str r5, [r4, #40]
297520: eb03bf34 bl 3871f8 <_DeleteCriticalSection>
297524: e5c45000 strb r5, [r4]
297528: e8bd8030 ldmia sp!, {r4, r5, pc}
0029752c <__ZN4java4lang6Object9sync_initEv>:
29752c: e92d4070 stmdb sp!, {r4, r5, r6, lr}
297530: e59f50ac ldr r5, [pc, #172] ; 2975e4 <__ZN4java4lang6Object9sync_initEv+0xb8>
297534: e1a06000 mov r6, r0
297538: e2850008 add r0, r5, #8 ; 0x8
29753c: eb040902 bl 39994c <_EnterCriticalSection>
297540: e59f20a0 ldr r2, [pc, #160] ; 2975e8 <__ZN4java4lang6Object9sync_initEv+0xbc>
297544: e5953004 ldr r3, [r5, #4]
297548: e596c004 ldr ip, [r6, #4]
29754c: e5921000 ldr r1, [r2]
297550: e2833001 add r3, r3, #1 ; 0x1
297554: e35c0000 cmp ip, #0 ; 0x0
297558: e3a00040 mov r0, #64 ; 0x40
29755c: e885000a stmia r5, {r1, r3}
297560: 0a000002 beq 297570 <__ZN4java4lang6Object9sync_initEv+0x44>
297564: e5dc3000 ldrb r3, [ip]
297568: e3530000 cmp r3, #0 ; 0x0
29756c: 1a00000e bne 2975ac <__ZN4java4lang6Object9sync_initEv+0x80>
297570: eb014373 bl 2e8344 <__Z14_Jv_AllocBytesi>
297574: e3a03000 mov r3, #0 ; 0x0
297578: e1a04000 mov r4, r0
29757c: e280002c add r0, r0, #44 ; 0x2c
297580: e5843028 str r3, [r4, #40]
297584: e5843024 str r3, [r4, #36]
297588: eb03bf07 bl 3871ac <_InitializeCriticalSection>
29758c: e2840004 add r0, r4, #4 ; 0x4
297590: eb014638 bl 2e8e78 <__Z12_Jv_CondInitP23_Jv_ConditionVariable_t>
297594: e3a03001 mov r3, #1 ; 0x1
297598: e1a00004 mov r0, r4
29759c: e59f1048 ldr r1, [pc, #72] ; 2975ec <__ZN4java4lang6Object9sync_initEv+0xc0>
2975a0: e5c43000 strb r3, [r4]
2975a4: eb014382 bl 2e83b4 <__Z21_Jv_RegisterFinalizerPvPFvPN4java4lang6ObjectEE>
2975a8: e5864004 str r4, [r6, #4]
2975ac: e59f2034 ldr r2, [pc, #52] ; 2975e8 <__ZN4java4lang6Object9sync_initEv+0xbc>
2975b0: e5953000 ldr r3, [r5]
2975b4: e5921000 ldr r1, [r2]
2975b8: e59f0030 ldr r0, [pc, #48] ; 2975f0 <__ZN4java4lang6Object9sync_initEv+0xc4>
2975bc: e1530001 cmp r3, r1
2975c0: 0a000000 beq 2975c8 <__ZN4java4lang6Object9sync_initEv+0x9c>
2975c4: e8bd8070 ldmia sp!, {r4, r5, r6, pc}
2975c8: e5953004 ldr r3, [r5, #4]
2975cc: e2433001 sub r3, r3, #1 ; 0x1
2975d0: e3530000 cmp r3, #0 ; 0x0
2975d4: e5853004 str r3, [r5, #4]
2975d8: 05853000 streq r3, [r5]
2975dc: eb0408dd bl 399958 <_LeaveCriticalSection>
2975e0: eafffff7 b 2975c4 <__ZN4java4lang6Object9sync_initEv+0x98>
2975e4: 00594a90 ldreqb r4, [r9], -#160
2975e8: ffffc808 swinv 0x00ffc808
2975ec: 00297508 eoreq r7, r9, r8, lsl #10
2975f0: 00594a98 ldreqb r4, [r9], -#168
Thus it appears that:
1. The configuration is done so that the finalizer, finalize_sync_info()
is there as it should be.
2. finalize_sync_info() contains the needed DCS
3. The finalizer is apparently "registered" via the RegisterFinalizer
call.
Thus all indications are that the finalizer is simply not being called.
Where do finalizers get called? Presumably in the GC, right?
If possible please advise us on what we ought to try to do next.
TIA,
craig vanderborgh
voxware incorporated