[PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( EG(symbol_table), varKey, newVar );

and then I do:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( EG(symbol_table), varKey, newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Zeev Suraski

At 08:53 PM 5/17/2002, Robert Cummings wrote:
Let's say I do:

 zval *newVar;
 MAKE_STD_ZVAL( newVar );
 ZEND_SET_SYMBOL( EG(symbol_table), varKey, newVar );

and then I do:

 MAKE_STD_ZVAL( newVar );
 ZEND_SET_SYMBOL( EG(symbol_table), varKey, newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Whatever you register into the standard data structures, EG(symbol_table) 
included, is taken care of by the engine.  In that case, the old value will 
be destroyed as soon as you replace it in the 2nd SET_SYMBOL call.

Zeev


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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
 
 At 08:53 PM 5/17/2002, Robert Cummings wrote:
 Let's say I do:
 
  zval *newVar;
  MAKE_STD_ZVAL( newVar );
  ZEND_SET_SYMBOL( EG(symbol_table), varKey, newVar );
 
 and then I do:
 
  MAKE_STD_ZVAL( newVar );
  ZEND_SET_SYMBOL( EG(symbol_table), varKey, newVar );
 
 This will overwrite my orignal newVar, however, will the original
 newVar be garbaged collected or is this my responsibility now that
 I'm out of PHP land? Also if it is auto garbage collected, is there
 a way I can force garbage collection to run while I'm in a deep
 recursion?
 
 Whatever you register into the standard data structures, EG(symbol_table)
 included, is taken care of by the engine.  In that case, the old value will
 be destroyed as soon as you replace it in the 2nd SET_SYMBOL call.

To be honest I'm passing the return_value into my recursion
- is the same true of it? I ask because I watched my memory
consumption climb to over 500MB and all I use is
MAKE_STD_ZVAL( newVar ) and insert into some depth of the
recursion initially stored into return_value for the
calling function. My initial assumption was that indeed this
stuff is garbage collected... but maybe I'm doing something
wrong if this is collected at the moment of overwrite and
I'm seeing such massive allocations using top.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Zeev Suraski

At 09:04 PM 5/17/2002, Robert Cummings wrote:
To be honest I'm passing the return_value into my recursion

Not sure what you mean by that - return_value is handled by the engine as 
soon as you return from your function implementation, if that's what you're 
asking.  If you're using it internally, then you're responsible for it 
until you return from your code.

Zeev


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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
 
 At 09:04 PM 5/17/2002, Robert Cummings wrote:
 To be honest I'm passing the return_value into my recursion
 
 Not sure what you mean by that - return_value is handled by the engine as
 soon as you return from your function implementation, if that's what you're
 asking.  If you're using it internally, then you're responsible for it
 until you return from your code.

Well I'm creating a nested hash that I want to return ultimately, so
at my first recursive step I pass return_value as the hash to be filled.
However at various steps in the recursion I add elements to the hash that
overwrite default values. So my question is whether during this recursive
process does the garbage collector run when I overwrite a hash entry?
Hope that clears things up.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Zeev Suraski

If you're adding elements to a hash you created using array_init(), and 
you're using the standard macros (which apparently you are) - then yes, the 
engine will take care of garbage collection for you.

At 09:27 PM 5/17/2002, Robert Cummings wrote:
Zeev Suraski wrote:
 
  At 09:04 PM 5/17/2002, Robert Cummings wrote:
  To be honest I'm passing the return_value into my recursion
 
  Not sure what you mean by that - return_value is handled by the engine as
  soon as you return from your function implementation, if that's what you're
  asking.  If you're using it internally, then you're responsible for it
  until you return from your code.

Well I'm creating a nested hash that I want to return ultimately, so
at my first recursive step I pass return_value as the hash to be filled.
However at various steps in the recursion I add elements to the hash that
overwrite default values. So my question is whether during this recursive
process does the garbage collector run when I overwrite a hash entry?
Hope that clears things up.

Cheers,
Rob.
--
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'


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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
 
 If you're adding elements to a hash you created using array_init(), and
 you're using the standard macros (which apparently you are) - then yes, the
 engine will take care of garbage collection for you.

Thanks a lot, this is what I needed to know, I guess somehow I have
allocation going on somewhere else.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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