redis / hiredis

Minimalistic C client for Redis >= 1.2
BSD 3-Clause "New" or "Revised" License
6.25k stars 1.82k forks source link

Feature Request: Custom allocator with userdata #958

Open Asmod4n opened 3 years ago

Asmod4n commented 3 years ago

Hello :)

I would like to have a way to plug a custom allocator with userdata. mrubys allocator functions require one more argument than normal allocators so they can run the mruby gargabe collector.

michael-grunder commented 3 years ago

Hi, sorry for the delay.

What user data would you be looking for? Would context->privdata suffice or do you mean a different mechanism?

It's simple enough to add an extra parameter but the trick will be doing it in a way that doesn't break backward compatibility.

Asmod4n commented 3 years ago

Anything would be good, just something the allocator can access in a hiredis context.

One sadly cannot just declare a global variable to hold that information because mruby can be started more than once per process.