bblanchon / pdfium-binaries

📰 Binary distribution of PDFium
789 stars 166 forks source link

Linux: set `use_allocator_shim` to `false` #128

Closed kleisauke closed 7 months ago

kleisauke commented 7 months ago

On most platforms, Chrome intercepts and reroutes the malloc() / operator new symbols (and corresponding free() / delete and other variants), using the allocator shim. Subsequently, the allocator shim typically directs these symbols to the PartitionAlloc memory allocator. https://github.com/chromium/chromium/blob/119.0.6019.3/base/allocator/partition_allocator/partition_alloc.gni#L28-L31

Overriding these functions can lead to compatibility issues when being linked against other shared libraries, leading to unexpected behavior or crashes.

Set use_allocator_shim = false to disable this behavior.

Resolves #124.

bblanchon commented 7 months ago

Thank you very much for all the tests you did! Do you think this change could have a negative impact for some users?

kleisauke commented 7 months ago

Do you think this change could have a negative impact for some users?

AFAIK, the only impact would be that allocations of dependencies from PDFIum (e.g. FreeType and others) would not be routed to the PartitionAlloc memory allocator, but rather to some platform allocator, but I'm not sure if that would be considered a bad thing.

pdf_use_partition_alloc = false is another way to resolve this, but that was not being recommended according to this doc.