Description:
------------
echo "<pre>":
var_dump(apc_sma_info());
$k = "a....................................................";
apc_store($k, 1);
for ($i = 0; $i < 10000; $i ++) {
apc_fetch($k);
}
var_dump(apc_sma_info());
reload the page 2+ times to see the result
i guess it's the key memory leak
Comments
[2004-10-19 02:29 UTC] xuefer at 21cn dot com
i've move filename from entry to key.data, renamed as identifier
now both file/user have "char *" which have exactly same behavior and function(usage)
then, i merge union struct into key struct(just make it simple)
copy pointer instead of apc_xstrdup in apc_make_*key identifier
but do apc_xstrdup in make_slot, free it in free_slot
everything goes fine, including my APC_USE_INODE seems have no core dump again
the merge of filename&identifyer make it easy to inode free
[2004-10-26 20:49 UTC] gschlossnagle at php dot net
Can you post a patch,please?
[2004-10-27 01:22 UTC] xuefer at 21cn dot com
sure, i was hunting for space to upload
ftp://211.92.88.40/pub/moo/apc_win32.patch (with other bug fixed)
apc_cache.c apc_cache.h:
fixed for APC_USE_INODE
the struct of key is changed, maybe u don't agree.
never do strdup for key before insert!(make_slot)
"find" on the cache is more frequent than insert
apc_compile.c:
don't care about builtin_functions
apc_fcntl.c:
we have 2 locks but why only 1 file used?
apc_mmap.c:
mmap depends on shm?
"#ifdef shm_open" works? maybe u can make marco in config.m4
apc_sem.c: remove redefine warnning, maybe wrong fix
apc_shm.c: IPC_PRIVATE of TSRM seems buggy, the 2nd process will not able to create the shm
other changes:
for apc_cache apc_user_cache, don't put it in GLOBALS
------------
ftp://211.92.88.40/pub/moo/apc_optimizer.c.patch
some of this patch is posted in another bug report
this time have a new fix:
function rewrite_const_cast
- zval_dtor(&cur->op1.u.constant);
+ /*zval_dtor(&cur->op1.u.constant);*/
i never used (string)'1' but phpmyadmin do, so i found this corrupt when i test with win32 (which i have installed phpmyadmin)
although i modified constant_fold, it's still not fixed :(
optimizer is written by cute gschlossnagle right? i saw a stantalone-but-very-old version in cvs/pecl :P
maybe u can have a review on it
any question or complain about the patch is welcome
[2004-10-27 01:29 UTC] xuefer at 21cn dot com
"fixed" for APC_USE_INODE
should be:
"improved" for APC_USE_INODE
btw:
this "const_cast" make phpmyadmin fine
but before "const_cast" fix(and after my other optimizer fix), it's still quite stable
it's used in production server(100MB traffic), only quite a few core dumps(for builtin_function in apc_compile) maybe 1 dump for 4months
i'd suggest make apc.optimizer to NOT EXPERIMENTAL
I have committed a variation of your apc_fetch memory leak fix. You changed all sorts of other stuff in your supplied patches and we will look at these separately. One bug per report please.