Skip to content

Conversation

@devnexen
Copy link
Member

No description provided.

@NattyNarwhal
Copy link
Member

Stupid question: why glib? Could we get away with using the internals HashTable with shared memory?

@devnexen
Copy link
Member Author

the glib hashtable implementation is multiplatform, solid and fast so it lessen the burden of implementation.

@devnexen devnexen force-pushed the session_mem_rewrite branch from f8bd3cf to d4c9c26 Compare January 4, 2026 08:05
@devnexen devnexen marked this pull request as ready for review January 4, 2026 08:28
@devnexen devnexen requested a review from Girgias as a code owner January 4, 2026 08:28
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable, but I'm not a ZTS specialist, I would like @arnaud-lb opinion on the ZTS aspect. :)

zend_result ret;

ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1);
ps_mm_instance = calloc(1, sizeof(*ps_mm_instance));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be ecalloc() or must it be the system malloc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm not sure we can use zendmm that early but I ll try later

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must be a persistent allocator (system one or pecalloc(..., true))

@Girgias Girgias requested a review from arnaud-lb January 9, 2026 00:37
#include "php.h"

#ifdef HAVE_LIBMM
#ifdef HAVE_LIBGLIB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need similar changes in ext/session/session.c, otherwise mod_mm is not enabled.

{
data->owner = getpid();
data->mm = mm_create(0, path);
data->mm = g_mapped_file_new(path, TRUE, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails on my machine when path doesn't exist

data->hash_cnt = 0;
data->hash_max = 511;
data->hash = mm_calloc(data->mm, data->hash_max + 1, sizeof(ps_sd *));
data->hash = g_hash_table_new(ps_mm_hash, ps_mm_key_equals);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with glib, does the call to g_mapped_file_new() above imply that every g_ function will use that mapped file for allocation?

@arnaud-lb
Copy link
Member

The approach for ZTS supports seems fine, but I don't understand how this is using shared memory. Could you clarify @devnexen?

@devnexen
Copy link
Member Author

devnexen commented Jan 9, 2026

I think I may have been "extra zealous" regarding ZTS but I ll look after your remarks sometime this week end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants