I've run as well into this problem, and my solution was to have one
managing task which spawns sub-tasks which do the work. Since the
parent task does not perform anything but executing new tasks it's
memory usage is stable.

IMO this is also the more secure way to go, since your task might
abort for some reason and it's easier to resume if you have such an
architecture.

Kind regards
Johannes

On 2 Feb., 21:39, Brandon Turner <[email protected]> wrote:
> Devs,
>
> This is my first post to the symfony-devs list.  It is not intended to
> be a "how do I do xxx" post, so I apologized if it is perceived as such.
>
> I've witnessed a couple of situations where I run out of memory in
> Symfony 1.4.1 (on PHP 5.3.1) when using Doctrine in tasks:
> (a) Loading a large fixture file via doctrine:data-load (ticket #7733)
> (b) Long running tasks containing simple Doctrine queries within an
> application context (--application command option is set)
>
> As far as I can tell, this is because the Doctrine_Connection_Profiler
> is enabled in both of these situations.  I've described this in more
> detail on the symfony-users list 
> here:http://groups.google.com/group/symfony-users/msg/f9b7ddb5b628a928
>
> In short, the profiler is enabled because I do not explicitly disable it
> in my databases.yml file with the profiler parameter and because
> sf_debug is set by sfBaseTask when using the an application context.
>
> My specific questions:
> 1) It seems the only way to disable the profiler is to set the profiler
> database parameter to false.  I think the only way to do this is via
> databases.yml.  Thus, for tasks, I create a new environment with the
> profiler setting and run my tasks using this environment.  I'm wondering
> if this is the intended behavior, or if this is a bug?
>
> 2) I don't fully understand the Doctrine_Connection_Profiler, but it
> appears to store all query objects for the entire connection.  Is
> turning the profiler off the correct thing to do for long running tasks,
> or is there a better way to control memory usage?
>
> 3) Why does sfBaseTask hard code sf_debug to true regardless of
> environment?  This is what enables the Doctrine_Connection_Profiler when
> the profiler database parameter isn't set.
>
> In any long-running code I write I make sure I free and unset Doctrine
> objects.  All of my code works when not using an application context to
> run tasks.  I cannot get the doctrine:data-load task to work without
> increasing PHP's memory_limit.
>
> Thanks in advance for any help you can offer.  I'm happy to help (file
> bug report|patch|test|document) in any way I can to fix this.
>
> Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en.

Reply via email to