https://bugs.kde.org/show_bug.cgi?id=445607

--- Comment #9 from Paul Floyd <pjfl...@wanadoo.fr> ---
Does --track-origins=yes show anything useful?

What is happening here pl_thread_idle2_va (src/pl-alloc.c:1899) ?

==59737== Thread 2 gc:
==59737== Conditional jump or move depends on uninitialised value(s)
==59737==    at 0x4077122: TCMallocImplementation::MarkThreadBusy() (in
/usr/local/lib/libtcmalloc_minimal.so.4.5.9)
==59737==    by 0x42B68D2: pl_thread_idle2_va (src/pl-alloc.c:1899)
==59737==    by 0x42C86D9: PL_next_solution (src/pl-vmi.c:3839)
==59737==    by 0x42E0AD1: PL_call_predicate (src/pl-fli.c:4145)
==59737==    by 0x439B2C7: GCmain (src/pl-thread.c:5527)
==59737==    by 0x4AAAFAB: ??? (in /basejail/lib/libthr.so.3)

>From what I can see online the swi-pl code is doing this

In initTCMalloc

  fMallocExtension_MarkThreadBusy =
    PL_dlsym(NULL, "MallocExtension_MarkThreadBusy");


In PRED_IMPL("thread_idle", 2, thread_idle, PL_FA_TRANSPARENT)

  if ( fMallocExtension_MarkThreadBusy )
    fMallocExtension_MarkThreadBusy();

In tcmalloc

class TCMallocImplementation : public MallocExtension {

  virtual void MarkThreadBusy();  // Implemented below
...

void TCMallocImplementation::MarkThreadBusy() {
  // Allocate to force the creation of a thread cache, but avoid
  // invoking any hooks.
  do_free(do_malloc(0));
}

Calling a C++ virtual function through a C pointer to function isn't safe. In
this case the virtual function doesn't seem to use 'this'. do_free and
do_malloc are inlined so it's hard to see exactly what is going on in
MarkThreadBusy

But I wonder if tcmalloc needs some global initialization before these calls.
Not sure how to debug that.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to