Memory Leak

View: New views
12 Messages — Rating Filter:   Alert me  

Memory Leak

by Jaime Herreros B. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I have a web system which uses Active4D 402 with 4D Server 2004.5 on  
Windows XP. I didn't design this, it just came to me....
The thing is that as the users surf memory used by 4D (as shown at the  
tasks manager in Windows XP) climbs slowly but permanently up till 4D  
shows a Memory Full error.

Active4D is badly used as every page calls a 4D method which returns a  
blob that is send to the browser using set response buffer. 4D methods  
generate the full HTML... I know, I know, thats why I started by  
saying that this system just came to me.

Any ideas on where o what to look for?

TIA,

Jaime
_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by B. Perkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The first thing that comes to mind is that the BLOB that is being
created by 4D is not being cleared after use. Does the code that builds
the HTML set the BLOB size to 0 before it builds the page. Runtime
explorer (on your server) should be able to easy tell you this.

-- Brad Perkins

Jaime Herreros wrote:

> Dear all,
>
> I have a web system which uses Active4D 402 with 4D Server 2004.5 on
> Windows XP. I didn't design this, it just came to me....
> The thing is that as the users surf memory used by 4D (as shown at the
> tasks manager in Windows XP) climbs slowly but permanently up till 4D
> shows a Memory Full error.
>
> Active4D is badly used as every page calls a 4D method which returns a
> blob that is send to the browser using set response buffer. 4D methods
> generate the full HTML... I know, I know, thats why I started by
> saying that this system just came to me.
>
> Any ideas on where o what to look for?
>
> TIA,
>
> Jaime
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
>

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I have a web system which uses Active4D 402 with 4D Server 2004.5 on  
> Windows XP. I didn't design this, it just came to me....

Lucky you...


> The thing is that as the users surf memory used by 4D (as shown at  
> the tasks manager in Windows XP) climbs slowly but permanently up  
> till 4D shows a Memory Full error.

Is anyone else having problems with memory usage? I did a test here  
and saw that memory usage was very slowly climbing, but it wasn't a  
conclusive test.


> Active4D is badly used as every page calls a 4D method which returns  
> a blob that is send to the browser using set response buffer.

If every page is calling a 4D method to generate HTML, there is very  
little point in using Active4D.

I checked my code to see if there is a possible leak when returning a  
blob from a 4D method or when setting the response buffer, but I  
couldn't see anything.

My first suggestion is to replace all of the calls to 'set response  
buffer' to 'write blob', see if that has any effect.

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org


_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by B. Perkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
>
> Is anyone else having problems with memory usage? I did a test here
> and saw that memory usage was very slowly climbing, but it wasn't a
> conclusive test.
>
If it is happening the increase is so slow that it is a non-issue.

-- Brad Perkins
_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by Jaime Herreros B. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



El 10-07-2008, a las 12:17, Aparajita Fishman escribió:

>> I have a web system which uses Active4D 402 with 4D Server 2004.5  
>> on Windows XP. I didn't design this, it just came to me....
>
> Lucky you...
>
>
jajajajajajajajajajajajajajajaj

>> The thing is that as the users surf memory used by 4D (as shown at  
>> the tasks manager in Windows XP) climbs slowly but permanently up  
>> till 4D shows a Memory Full error.
>
> Is anyone else having problems with memory usage? I did a test here  
> and saw that memory usage was very slowly climbing, but it wasn't a  
> conclusive test.
>
>
>> Active4D is badly used as every page calls a 4D method which  
>> returns a blob that is send to the browser using set response buffer.
>
> If every page is calling a 4D method to generate HTML, there is very  
> little point in using Active4D.

I know, but rewriting at this moment is not an option. It's obviously  
planned for near future....

>
>
> I checked my code to see if there is a possible leak when returning  
> a blob from a 4D method or when setting the response buffer, but I  
> couldn't see anything.
>
> My first suggestion is to replace all of the calls to 'set response  
> buffer' to 'write blob', see if that has any effect.

In fact we used write blob in the beggining and changed it to set  
response buffer to see the effect. No effect.

The calling chain is as follows:

(1) the a4d file calls a method in an a4l library

agenda.veragenda($textParam1;$textParam2;$textParam3;....)

(2) the method in the a4l library calls a 4D method

C_BLOB(vx_HTMLBlob)
C_BLOB(vx_Dummy)

$result := 4DMehod ($theParam1;$textParam2;...;->vx_HTMLBlob)

if($result =0)
        set response buffer(vx_HTMLBlob;"text/html")
else
        writebr("ERROR!!!")
End If
vx_HTMLBlob:=vx_Dummy

(3) 4DMethod receives a pointer to a blob (vx_HTMLBlob) in, say $9.  
4DMethod does some stuff (not touching the blob) and calls 4DMethod2  
($theParam1;$textParam2;...;$9).

(4) 4DMethod2 calls 4DMethod3 passing the pointer to the blob along.

(5) The final method in the chain finally fills the blob which is then  
sent to the browser with set response buffer.

(6) vx_HTMLBlob is assigned a dummy empty blob at the end to clean it  
from memory (that is not original code, I did it so as to test).

Do you see something that might be causing the problem?

>
>
> Regards,
>
>   Aparajita
>   www.aparajitaworld.com
>
>   "If you dare to fail, you are bound to succeed."
>   - Sri Chinmoy   |   www.srichinmoy.org
>
>
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by Jaime Herreros B. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In fact the first thing the code does is setting blob size to 0 before  
filling it up...




Jaime

El 10-07-2008, a las 11:59, Brad Perkins escribió:

> The first thing that comes to mind is that the BLOB that is being  
> created by 4D is not being cleared after use. Does the code that  
> builds the HTML set the BLOB size to 0 before it builds the page.  
> Runtime explorer (on your server) should be able to easy tell you  
> this.
>
> -- Brad Perkins
>
> Jaime Herreros wrote:
>> Dear all,
>>
>> I have a web system which uses Active4D 402 with 4D Server 2004.5  
>> on Windows XP. I didn't design this, it just came to me....
>> The thing is that as the users surf memory used by 4D (as shown at  
>> the tasks manager in Windows XP) climbs slowly but permanently up  
>> till 4D shows a Memory Full error.
>>
>> Active4D is badly used as every page calls a 4D method which  
>> returns a blob that is send to the browser using set response  
>> buffer. 4D methods generate the full HTML... I know, I know, thats  
>> why I started by saying that this system just came to me.
>>
>> Any ideas on where o what to look for?
>>
>> TIA,
>>
>> Jaime
>> _______________________________________________
>> Active4D-dev mailing list
>> Active4D-dev@...
>> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
>> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
>>
>
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> C_BLOB(vx_HTMLBlob)
> C_BLOB(vx_Dummy)
>
> $result := 4DMehod ($theParam1;$textParam2;...;->vx_HTMLBlob)
>
> if($result =0)
> set response buffer(vx_HTMLBlob;"text/html")
> else
> writebr("ERROR!!!")
> End If
> vx_HTMLBlob:=vx_Dummy

Hmmm...there are a couple places I could be leaking memory, I will  
have to investigate further.


> (6) vx_HTMLBlob is assigned a dummy empty blob at the end to clean  
> it from memory (that is not original code, I did it so as to test).

Better to use SET BLOB SIZE(0).

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org


_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by Jaime Herreros B. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When I use SET BLOB SIZE in en a4l method I get an error. Seems that  
SET BLOB SIZE is not supported in Active4D...


Jaime


El 10-07-2008, a las 13:51, Aparajita Fishman escribió:

>> C_BLOB(vx_HTMLBlob)
>> C_BLOB(vx_Dummy)
>>
>> $result := 4DMehod ($theParam1;$textParam2;...;->vx_HTMLBlob)
>>
>> if($result =0)
>> set response buffer(vx_HTMLBlob;"text/html")
>> else
>> writebr("ERROR!!!")
>> End If
>> vx_HTMLBlob:=vx_Dummy
>
> Hmmm...there are a couple places I could be leaking memory, I will  
> have to investigate further.
>
>
>> (6) vx_HTMLBlob is assigned a dummy empty blob at the end to clean  
>> it from memory (that is not original code, I did it so as to test).
>
> Better to use SET BLOB SIZE(0).
>
> Regards,
>
>   Aparajita
>   www.aparajitaworld.com
>
>   "If you dare to fail, you are bound to succeed."
>   - Sri Chinmoy   |   www.srichinmoy.org
>
>
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> When I use SET BLOB SIZE in en a4l method I get an error. Seems that  
> SET BLOB SIZE is not supported in Active4D...

It will be, in the meantime try:

execute in 4d("SET BLOB SIZE(vx_HTMLBlob;0)")

One thing I would like you to try: instead of passing a pointer to  
vx_HTMLBlob, don't pass it at all and just reference that variable in  
the 4D methods. This will eliminate the possibility of the pointer  
causing the problem.

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org


_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by Jaime Herreros B. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'l try both... give some time as the system is on line and live!!!!  
about 100 conections average....


Thanks!!!

Jaime Herreros
Jefe de Operaciones
Colegium S.A

La información contenida en esta transmisión es confidencial y está  
dirigida exclusivamente a el o los destinatarios indicados. Cualquier  
uso por otras personas que no sean sus destinatarios está sancionado  
por la ley chilena. Si ha recibido esta transmisión por error, por  
favor destrúyala y notifique al remitente si corresponde. Las  
opiniones expresadas en este correo son las de su autor y pueden no  
ser compartidas por la compañía. Colegium no asume obligaciones ni  
responsabilidades por el contenido de este correo. Tampoco garantiza  
que la transmisión de este correo sea segura o libre de errores, y en  
consecuencia, no responde por virus, pérdidas, destrucción, recepción  
tardía o incompleta.
The information contained herein is confidential and is directed to  
the intended addressee(s) only. Any use by any other people is  
sanctioned by the Chilean law. If you have received this transmission  
in error, please delete it and warn the sender. The opinions expressed  
in this message are the author's responsibility and may not be the  
company's. Colegium does not assume obligations nor responsibilities  
by the content of this mail. It is not guaranteed either that the  
transmission of this message is safe and/or free from errors or  
viruses. In consequence Colegium is not responsible for direct or  
indirect losses, destruction, as well as for delayed or incomplete  
messages.



El 10-07-2008, a las 16:20, Aparajita Fishman escribió:

>> When I use SET BLOB SIZE in en a4l method I get an error. Seems  
>> that SET BLOB SIZE is not supported in Active4D...
>
> It will be, in the meantime try:
>
> execute in 4d("SET BLOB SIZE(vx_HTMLBlob;0)")
>
> One thing I would like you to try: instead of passing a pointer to  
> vx_HTMLBlob, don't pass it at all and just reference that variable  
> in the 4D methods. This will eliminate the possibility of the  
> pointer causing the problem.
>
> Regards,
>
>   Aparajita
>   www.aparajitaworld.com
>
>   "If you dare to fail, you are bound to succeed."
>   - Sri Chinmoy   |   www.srichinmoy.org
>
>
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I'l try both... give some time as the system is on line and live!!!!  
> about 100 conections average....

The first thing you need to do then is to get yourself a test system.  
It is suicidal to develop on a production system.

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org


_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Memory Leak

by Jaime Herreros B. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

execute in 4d("SET BLOB SIZE(vx_HTMLBlob;0)") had no effect at all...

The other change will be done as soon as we set the test server (which  
we should have done long ago)...

Meanwhile I'll wait for your testing for leaks...

Thanks a lot!!!


Jaime


El 10-07-2008, a las 16:20, Aparajita Fishman escribió:

>> When I use SET BLOB SIZE in en a4l method I get an error. Seems  
>> that SET BLOB SIZE is not supported in Active4D...
>
> It will be, in the meantime try:
>
> execute in 4d("SET BLOB SIZE(vx_HTMLBlob;0)")
>
> One thing I would like you to try: instead of passing a pointer to  
> vx_HTMLBlob, don't pass it at all and just reference that variable  
> in the 4D methods. This will eliminate the possibility of the  
> pointer causing the problem.
>
> Regards,
>
>   Aparajita
>   www.aparajitaworld.com
>
>   "If you dare to fail, you are bound to succeed."
>   - Sri Chinmoy   |   www.srichinmoy.org
>
>
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
LightInTheBox - Buy quality products at wholesale price!