Embedded JDK how to replace the default allocator

David Holmes david.holmes at oracle.com
Tue Dec 15 00:09:26 UTC 2020


On 15/12/2020 9:08 am, Guy Korland wrote:
> I'm talking about replacing the malloc implementation, we're running on
> Linux.
> But, the tricky part is that my C application malloc should not be changed,
> only the libjvm.so when loaded embedded in my application.

I don't know if this works, or you are able to do it, but statically 
linking your application with its desired malloc library, and using 
LD_PRELOAD for the JVMs might work.

Cheers,
David
-----

> Regards,
> Guy Korland
> 
> 
> On Sun, Dec 13, 2020 at 12:15 PM Thomas Stüfe <thomas.stuefe at gmail.com>
> wrote:
> 
>> Hi Guy,
>>
>> What do you mean by default allocator? C-Heap? Mmap/shmat? And what OS are
>> you targeting?
>>
>> Cheers, Thomas
>>
>> On Fri, Dec 11, 2020 at 9:49 PM Guy Korland <gkorland at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm sorry if that is not the right mailing list for such questions, please
>>> point me to the right one if it's not.
>>>
>>> We're embedding the OpenJDK in a C application, we already managed to make
>>> it work and run Java bytecode, but we are still missing one last piece, we
>>> need a way to replace the default memory allocator to use our allocator.
>>>
>>> Is there a way to do it?
>>>
>>> Thanks,
>>> Guy Korland
>>>
>>


More information about the hotspot-dev mailing list