473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Memory leak in PHP

I've heard that the Zend Engine's garage collector is not perfect, so
can someone demonstrate how to create a memory leak in PHP?

Jun 16 '07 #1
9 2173
Benjamin wrote:
I've heard that the Zend Engine's garage collector is not perfect, so
can someone demonstrate how to create a memory leak in PHP?
ZE doesn't use garbage collector, it implements reference counting
algorithm that is notorious for its inability to handle circular
references. If you have an object A that holds a reference to B, and B
directly or indirectly refers back to A, neither A nor B will be freed
until the script ends.

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jun 16 '07 #2
On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
Benjamin wrote:
I've heard that the Zend Engine's garage collector is not perfect, so
can someone demonstrate how to create a memory leak in PHP?

ZE doesn't use garbage collector, it implements reference counting
algorithm that is notorious for its inability to handle circular
references. If you have an object A that holds a reference to B, and B
directly or indirectly refers back to A, neither A nor B will be freed
until the script ends.
According to Wikipedia (http://en.wikipedia.org/wiki/
Reference_counting), reference counting is a form of garbage
collecting.
>
--
gosha bine

extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok

Jun 18 '07 #3
On 18.06.2007 04:30 Benjamin wrote:
On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
>Benjamin wrote:
>>I've heard that the Zend Engine's garage collector is not perfect, so
can someone demonstrate how to create a memory leak in PHP?
ZE doesn't use garbage collector, it implements reference counting
algorithm that is notorious for its inability to handle circular
references. If you have an object A that holds a reference to B, and B
directly or indirectly refers back to A, neither A nor B will be freed
until the script ends.
According to Wikipedia (http://en.wikipedia.org/wiki/
Reference_counting), reference counting is a form of garbage
collecting.
The nice thing about Wikipedia is that if you find wrong or confusing
information there, you can correct it immediately. ;)
--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jun 18 '07 #4
gosha bine wrote:
On 18.06.2007 04:30 Benjamin wrote:
>On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
>>Benjamin wrote:
I've heard that the Zend Engine's garage collector is not perfect, so
can someone demonstrate how to create a memory leak in PHP?
ZE doesn't use garbage collector, it implements reference counting
algorithm that is notorious for its inability to handle circular
references. If you have an object A that holds a reference to B, and B
directly or indirectly refers back to A, neither A nor B will be freed
until the script ends.
According to Wikipedia (http://en.wikipedia.org/wiki/
Reference_counting), reference counting is a form of garbage
collecting.

The nice thing about Wikipedia is that if you find wrong or confusing
information there, you can correct it immediately. ;)

Except in this case it is not wrong or confusing. It is a method of
garbage collection.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 18 '07 #5
On 18.06.2007 14:11 Jerry Stuckle wrote:
gosha bine wrote:
>On 18.06.2007 04:30 Benjamin wrote:
>>On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
Benjamin wrote:
I've heard that the Zend Engine's garage collector is not perfect, so
can someone demonstrate how to create a memory leak in PHP?
ZE doesn't use garbage collector, it implements reference counting
algorithm that is notorious for its inability to handle circular
references. If you have an object A that holds a reference to B, and B
directly or indirectly refers back to A, neither A nor B will be freed
until the script ends.
According to Wikipedia (http://en.wikipedia.org/wiki/
Reference_counting), reference counting is a form of garbage
collecting.

The nice thing about Wikipedia is that if you find wrong or confusing
information there, you can correct it immediately. ;)


Except in this case it is not wrong or confusing. It is a method of
garbage collection.
Well, I know at least two people who are already confused. ;)

Before starting the next meaningless scholastic discussion about terms,
make sure you do understand how GCs work and what is the difference
between "tracing"/"full-automatic" GCs and reference counting.

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jun 18 '07 #6
gosha bine wrote:
On 18.06.2007 14:11 Jerry Stuckle wrote:
>gosha bine wrote:
>>On 18.06.2007 04:30 Benjamin wrote:
On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
Benjamin wrote:
>I've heard that the Zend Engine's garage collector is not perfect, so
>can someone demonstrate how to create a memory leak in PHP?
ZE doesn't use garbage collector, it implements reference counting
algorithm that is notorious for its inability to handle circular
references. If you have an object A that holds a reference to B, and B
directly or indirectly refers back to A, neither A nor B will be freed
until the script ends.
According to Wikipedia (http://en.wikipedia.org/wiki/
Reference_counting), reference counting is a form of garbage
collecting.

The nice thing about Wikipedia is that if you find wrong or confusing
information there, you can correct it immediately. ;)


Except in this case it is not wrong or confusing. It is a method of
garbage collection.

Well, I know at least two people who are already confused. ;)

Before starting the next meaningless scholastic discussion about terms,
make sure you do understand how GCs work and what is the difference
between "tracing"/"full-automatic" GCs and reference counting.
Believe me - I know how garbage collection works. I haven't been
programming longer than you've been alive without finding out.

You really need to understand the terminology before you start telling
people they're wrong.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 18 '07 #7
On 18.06.2007 16:15 Jerry Stuckle wrote:
gosha bine wrote:
>On 18.06.2007 14:11 Jerry Stuckle wrote:
>>gosha bine wrote:
On 18.06.2007 04:30 Benjamin wrote:
On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
>Benjamin wrote:
>>I've heard that the Zend Engine's garage collector is not
>>perfect, so
>>can someone demonstrate how to create a memory leak in PHP?
>ZE doesn't use garbage collector, it implements reference counting
>algorithm that is notorious for its inability to handle circular
>references. If you have an object A that holds a reference to B,
>and B
>directly or indirectly refers back to A, neither A nor B will be
>freed
>until the script ends.
According to Wikipedia (http://en.wikipedia.org/wiki/
Reference_counting), reference counting is a form of garbage
collecting.

The nice thing about Wikipedia is that if you find wrong or
confusing information there, you can correct it immediately. ;)

Except in this case it is not wrong or confusing. It is a method of
garbage collection.

Well, I know at least two people who are already confused. ;)

Before starting the next meaningless scholastic discussion about
terms, make sure you do understand how GCs work and what is the
difference between "tracing"/"full-automatic" GCs and reference counting.

Believe me - I know how garbage collection works. I haven't been
programming longer than you've been alive without finding out.

You really need to understand the terminology before you start telling
people they're wrong.

Of course, I believe you, Jerry. Everyone knows you are an experienced
programmer and smart polemicist.
--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jun 18 '07 #8
gosha bine wrote:
On 18.06.2007 16:15 Jerry Stuckle wrote:
>gosha bine wrote:
>>On 18.06.2007 14:11 Jerry Stuckle wrote:
gosha bine wrote:
On 18.06.2007 04:30 Benjamin wrote:
>On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
>>Benjamin wrote:
>>>I've heard that the Zend Engine's garage collector is not
>>>perfect, so
>>>can someone demonstrate how to create a memory leak in PHP?
>>ZE doesn't use garbage collector, it implements reference counting
>>algorithm that is notorious for its inability to handle circular
>>references. If you have an object A that holds a reference to B,
>>and B
>>directly or indirectly refers back to A, neither A nor B will be
>>freed
>>until the script ends.
>According to Wikipedia (http://en.wikipedia.org/wiki/
>Reference_counting), reference counting is a form of garbage
>collecting.
>
The nice thing about Wikipedia is that if you find wrong or
confusing information there, you can correct it immediately. ;)
>
>

Except in this case it is not wrong or confusing. It is a method of
garbage collection.
Well, I know at least two people who are already confused. ;)

Before starting the next meaningless scholastic discussion about
terms, make sure you do understand how GCs work and what is the
difference between "tracing"/"full-automatic" GCs and reference
counting.

Believe me - I know how garbage collection works. I haven't been
programming longer than you've been alive without finding out.

You really need to understand the terminology before you start telling
people they're wrong.


Of course, I believe you, Jerry. Everyone knows you are an experienced
programmer and smart polemicist.

And everyone knows you're full of horse hockey.

Learn what garbage collection is - then figure it out for yourself. You
seem to think the way Java does it is the only way. It's not.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 18 '07 #9
Jerry Stuckle wrote:
gosha bine wrote:
>On 18.06.2007 16:15 Jerry Stuckle wrote:
>>gosha bine wrote:
On 18.06.2007 14:11 Jerry Stuckle wrote:
gosha bine wrote:
>On 18.06.2007 04:30 Benjamin wrote:
>>On Jun 16, 3:35 am, gosha bine <stereof...@gmail.comwrote:
>>>Benjamin wrote:
>>>>I've heard that the Zend Engine's garage collector is not
>>>>perfect, so
>>>>can someone demonstrate how to create a memory leak in PHP?
>>>ZE doesn't use garbage collector, it implements reference counting
>>>algorithm that is notorious for its inability to handle circular
>>>references. If you have an object A that holds a reference to B,
>>>and B
>>>directly or indirectly refers back to A, neither A nor B will be
>>>freed
>>>until the script ends.
>>According to Wikipedia (http://en.wikipedia.org/wiki/
>>Reference_counting), reference counting is a form of garbage
>>collecting.
>>
>The nice thing about Wikipedia is that if you find wrong or
>confusing information there, you can correct it immediately. ;)
>>
>>
>
Except in this case it is not wrong or confusing. It is a method
of garbage collection.
>

Well, I know at least two people who are already confused. ;)

Before starting the next meaningless scholastic discussion about
terms, make sure you do understand how GCs work and what is the
difference between "tracing"/"full-automatic" GCs and reference
counting.
Believe me - I know how garbage collection works. I haven't been
programming longer than you've been alive without finding out.

You really need to understand the terminology before you start
telling people they're wrong.


Of course, I believe you, Jerry. Everyone knows you are an experienced
programmer and smart polemicist.


And everyone knows you're full of horse hockey.
Did I say "smart polemicist"? Yes indeed, very smart polemicist, strong
but always correct.
>
Learn what garbage collection is - then figure it out for yourself. You
seem to think the way Java does it is the only way. It's not.
Yeah, keep looking down on me. I'm glad I was helpful in raising your
self-esteem. Hope you're satisfied with yourself now.
--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Jun 18 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
4
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password";...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
7
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.