Am Montag, den 05.03.2007, 13:42 -0600 schrieb William A. Rowe, Jr.: > Just register one of two free functions as cleanups of the pool, based > on the origin of the data.
How could that help me? I think I don't get the idea. I think I should restate my problem. I can do something like ------------------------------------------------------------- static apr_pool_t *volatile p_cur = NULL; static void *xml2_alloc(size_t sz) { void *mem = apr_palloc(p_cur, sz + sizeof(size_t)); size_t *psz = mem; *psz = sz; return (char *) mem + sizeof(size_t); } ------------------------------------------------------------- There is the obvious ugliness of the current pool, which is easily possible with prefork, but difficult with others. There is also the problem that usage of pool memory in a filter is a de facto leak when large documents are encountered. I would prefer to do something like const unsigned int mgc = 0x88DEFEA7; static void *xml2_alloc(size_t sz) { void *mem = malloc(sz + sizeof(int)); const unsigned int *mark = mem; *mark = mgc; return (char *) mem + sizeof(int); } static void xml2_free(void *emem) { void *mem = (char *)emem - sizeof(int); const unsigned int *mark = mem; if (*mark == mgc) { free(mem); } } However I don't know if I can safely do that with apache memory (both, bucket alloc and pool) and if there is value for mgc I can use. Sincerely, Joachim