[Chicago-talk] Forking and Memory
Michael Potter
michael at potter.name
Mon Mar 21 04:52:14 PDT 2016
This is bit old thread, but I am replying anyway....
This line looks strange:
if (my $grandkid = fork) {
I would not expect the fork keyword there.
Just a hunch.
On Fri, Mar 11, 2016 at 12:01 PM, <richard at rushlogistics.com> wrote:
> I have this code below that forks to convert a large uploaded video. I
> just tried a 72M video and got:
> Route exception: Can't fork: Cannot allocate memory at
> /usr/local/share/perl/5.20.2/Mail/Transport/Sendmail.pm
>
> Is there something wrong with my code or do I need more RAM?
>
> if ($file_stg =~ /MOV/) {
>
> #print "File is a MOV\n";
> if (my $kid = fork()) {
>
> waitpid($kid, 0); # let the child die
>
> } else {
>
> if (my $grandkid = fork) {
>
> POSIX::_exit(0); # the child dies here
>
> } elsif (defined $kid && $kid == 0) {
> # child
>
> system("ffmpeg -i $self->{_video_in} -vcodec libx264 -profile:v
> main -level 3.1 -preset veryslow -crf 23 -x264-params ref=4 -acodec copy
> -movflags +faststart -vf scale=-2:720:flags=lanczos
> $self->{_video_out}.mp4");
>
> system("ffmpeg -i $self->{_video_out}.mp4 -c:v libtheora -c:a
> libvorbis $self->{_video_out}.ogv");
>
> #exit 0;
> POSIX::_exit(0)
> }
>
> }
>
> }
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
--
Michael Potter
Tapp Solutions, LLC
www.tappsolutions.com
+1 770 815 6142 ** Atlanta ** michael at potter.name **
www.linkedin.com/in/michaelpotter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20160321/de720fc7/attachment.html>
More information about the Chicago-talk
mailing list