[Kamailio-Devel] Creating shared memory during runtime

Iñaki Baz Castillo ibc at aliax.net
Fri Jan 9 18:36:13 CET 2009


Hi, if a Kamailio process (i.e. via a MI function) frees a shm variable and 
creates it again (so it would be now allocated in a memory different position 
and have a different size), will the rest of Kamailio running processes 
realize of it?

This is:

---------------------
char *string;

static int mod_init(void)
{
	string = shm_malloc(sizeof(char) * 100);
	// Store some value in 'string'.
}

static struct mi_root* mi_function(struct mi_root* cmd_tree, void* param) {
	shm_free(string);
	string = shm_malloc(sizeof(char) * 200);
	// Store some new value in 'string'.
}
---------------------

Will it work?
If not, how could achieve it? Must I reserve the max possible size 
in "mod_init()" and use the same pointer all the time during runtime?

Thanks.


-- 
Iñaki Baz Castillo



More information about the Devel mailing list