Bug 185762 - [GTK] Initialize bmalloc only when needed
Summary: [GTK] Initialize bmalloc only when needed
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-18 03:18 PDT by Milan Crha
Modified: 2022-04-10 09:07 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Crha 2018-05-18 03:18:23 PDT
Would it be possible to initialize bmalloc only when it is really needed, please?

It's currently enough to preload WebKitGTK+ library and there's that bmalloc thread which has also some side effects, like the Gigacage allocations and so on. The Gigacage causes problems in various scenarios, when it crashes instead of fail gracefully and let the process run. (Like bug #183329 and downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=1564970 ).

You can test it with such a simple program like this:

---------------------------------------

#include <stdio.h>
#include <stdlib.h>

int main (void)
{
	system ("sleep 30");
	return 0;
}

---------------------------------------

Compile it with:

   $ gcc simple.c -o simple -g

Then run it as:

   $ ./simple

and see its backtrace:

   $ gdb --batch --ex "t a a bt" -pid=`pidof simple`

which shows only a single thread and nothing else. Run it as this:

   $ LD_PRELOAD=/usr/lib64/libwebkit2gtk-4.0.so ./simple

and the backtrace will show also the bmalloc thread, even there's not called any single method from the webkit library.
Comment 1 Michael Catanzaro 2022-04-08 13:04:19 PDT
bmalloc is always needed, sorry.
Comment 2 Michael Catanzaro 2022-04-08 13:05:38 PDT
> int main (void)
>{
>	system ("sleep 30");
>	return 0;
>}


Um, I didn't read. As usual. Sorry. ;)
Comment 3 Milan Crha 2022-04-10 09:07:38 PDT
Yeah, it was meant as "initialize on demand, not on library load".

Feel free to close this, though. This is just about "nice to have", but if it would mean any unnecessary complexity of the code, then it does not worth it, I believe.