* Thus wrote Matt Anderson ([EMAIL PROTECTED]):
> Hi all,
> 
> I have a fairly advanced question regarding writting modules that create
> persistent resources:
> 
You might want to ask this over in php-dev, most people here dont
deal with the internals of php. 

> I've written a module very similar to the 'de-facto standard' mysql
> implementation, however its developed a strange bug.  Occasionally,
> after working with a persistent connection for a few page calls, php
> seems to 'forget' that its there, without calling the resources' cleanup
> handler.  The eventual result, sence the resource opens a socket
> connection to another server (my module binds another API into php), the
> connections will pile up needlessly.

I think it might have to do with this:

  hashed_identifier_len = strlen("evopvr___") + strlen(user) +
            strlen(passwd) + strlen(host);
  hashed_identifier = (char*) emalloc(hashed_identifier_len);
  sprintf(hashed_identifier, "evopvr_%s_%s_%s", user, passwd, host); 

  your emalloc() needs to add +1 to the allocated memory for the \0 at the
  end of the string of hashed_identifier.   So the next emalloc
  call will allocate the spot where your \0 is so you just lost the
  end of your string of hashed_identifier.


HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to