memory leaks and java ...

Adam Megacz adam@megacz.com
Thu Apr 3 09:24:00 GMT 2003


"Ranjit Mathew" <rmathew4lists@hotmail.com> writes:
> But in this case you are supposed to use "-mthreads" while
> linking in your program.

Right -- we're tricking the EH code into *thinking* that mingwm10 is
linked in, when in fact it is not.  This convinces the EH that it
should allocate a different setjmp() buffer for each thread, believing
that mingwm10.dll will deallocate it.

Since mingwm10.dll is NOT present (we're not using -mthreads), we leak
about 24 bytes of memory per thread created.  Somehow that doesn't
bother me, especially since a conservative garbage collector is likely
to leak more than that.

Recap:

-mthreads causes two things to happen:
    1.  CRT_MT defined ==> EH allocates different buffer for each thread
    2.  mingwm10.dll is linked in

We want (1) without (2), which is why I include the hack yet do NOT
put -mthreads in libgcj.spec.

  - a



More information about the Java mailing list