mourningdove/bin/worker/t-memlimit

42 lines
1.1 KiB
Text
Raw Normal View History

2026-05-24 01:03:05 +00:00
#!/usr/bin/perl
# This code was forked from the LiveJournal project owned and operated
# by Live Journal, Inc. The code has been modified and expanded by
# Dreamwidth Studios, LLC. These files were originally licensed under
# the terms of the license supplied by Live Journal, Inc, which can
# currently be found at:
#
# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
#
# In accordance with the original license, this code and all its
# modifications are provided under the GNU General Public License.
# A copy of that license can be found in the LICENSE file included as
# part of this distribution.
use strict;
BEGIN {
require "$ENV{LJHOME}/cgi-bin/ljlib.pl";
}
LJ::Worker::Test->set_memory_limit(40*1024*1024); # 80MB memory limit
LJ::Worker::Test->run;
package LJ::Worker::Test;
use base 'LJ::Worker::Manual';
my $iteration = 0;
my %heap;
# return 1 if we did work, false if not.
sub work {
my $class = shift;
$heap{$iteration++} = "x" x (1024 * 1024); # Shove 1MB onto the heap
print "Iteration: $iteration\n";
return 0;
}
#3 each:
#206, 207, 208, 235, 236, 247