Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthormrcyril
     
    Hi All

    I have an application that offers an export of data to CSV.

    This is an Intranet app. and the function will only be hit once a month or less so I haven't bothered with optimisation at this stage. Therefore the data is collated using multiple calls to find() on a has_many association.

    In my development environment (Mac, MAMP with PHP 5.2.0) the download / export takes just a few seconds to complete. This is good enough for what I need right now.

    In the production environment (Debian, php 5.2.0-8+etch10) I get a memory leak. Every call to find() increases the memory usage (as would be expected) but it never gets collected and I always exhaust my total memory

    There is a blog post here http://paul-m-jones.com/?p=262 that seems relevant.

    Has anyone come across anything similar to this and had a go at a workaround?

    Cyril
    •  
      CommentAuthorbermi
     

    Hi Cyril,

    I've had this issue many times and it was a very frustrating to debug, in fact I solved this by allowing more RAM when possible or dividing tasks in smaller pieces and running them as different processes.

    I was not aware of this PHP bug until now. Thank you for letting me know.

    I've just committed a hack/patch for this PHP bug

    • CommentAuthormrcyril
     
    Hi Bermi

    Many thanks for the quick patch.
    I now need to setup a Debian box to run my tests on. I'll let you know if all is now fixed.

    best wishes

    Cyril
    • CommentAuthoraekko85
     
    Hi,

    I'm experiencing the same issue : call to find cause memory leak.
    I've trying using the patch with freeMemory(). Things get a little better, but still memory usage is growing steadily.

    I've done some test doing a loop calling find by id on a table of about 40000 rows :
    Without memory realease I'm loosing about 10 Ko each iteration. And some random times (but always at the same iterations) I get bigger leaks : approximatly 35 Ko, then 60, 100, 200, 400.
    With freeMemory() and unset(), I'm "only" loosing 3.5 ko with random loss of 28, 50, 100, 200, 400, and 800.

    Dev environnement is Windows XP, Xampp 1.6.7, PHP 5.2.6

    I can give you the code and the xls I've done from the tests if you wish.
    • CommentAuthorKaste
     

    I'm using the same exact dev environment and can confirm that the patch isn't working (never was).

    I have to say that I just don't care ;-) as long as it works on a server.

    • CommentAuthoraekko85
     
    Well my exact problem about that memory leak is that it's quite an issue about putting my prog on production environnement.

    I need to analyse a lot of data, so doing a lot of find, and save, etc. I the same script. (I know that kind of sound clumsy, but choice is not always ours)

    Not a problem on dev environnment (RAM 4 Go), but kind of putting the serveur to its knees (RAM 128 Mo).

    So now it's running, but find all the work-around was a real pain

    Do you thing it's coming from php or from akelos ? Should I report it on php.net ?
    • CommentAuthorKaste
     

    That means it doesn't work on a linux-machine too? Or your prod-environment is windows?

    AFAIK (and I didnt looked at that bug too deeply) it is fixed in php 5.3. (look at their changelog)