Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Out of memory?

Status
Not open for further replies.

yitzle

Programmer
Sep 10, 2006
8
CA
Ooo..kay.
Purpose: generating an HTML page based on the user name.
Method:
I got this array of hashes.
Each element of the array corresponding to one HTML table row.
Based on the ( $album[$i] {'access'} -> {$user} ) a row is or is not printed.
I got 26 rows.
A sample hash element:
Code:
    {
        url => "[URL unfurl="true"]http://picasaweb.google.com/yitzchokGood/NatureStills",[/URL] name => "Nature/Still", size => 54,
        status => "c", location => "N/A", created => "?", modified => "?",
        access => { master => true, nathan => true, every => true}, account => "ygood"
    },
The code all works except that the output is stopping in middle of nowhere.
Um. The output code:
Code:
...
for ( $i = 1; $i <= @album; $i++) {
    if ( $album[$i] {'access'} -> {$user} ) {
        print qq~
            <TR>
            <TD><a target="content" href="$album[$i]{'url'}">$album[$i]{'name'}</a></TD>
            <TD>$album[$i]{'size'}</TD>
           
        ~;
        if ( $album[$i]{'status'} eq 'o' ) {
            print "<TD><B>Open</B></TD>";
        } else {
            print "<TD>Closed</TD>";
        }
        print qq~
            <TD>$album[$i]{'location'}</TD>
            <TD>$album[$i]{'created'}</TD>
            <TD>$album[$i]{'modified'}</TD>
            <TD>$album[$i]{'account'}</TD>
        ~;
        if ( $user eq "master" ) {
#            if ( $album[$i] {'access'} -> {"public"} ) {
#                print '<td style="text-align: center;">X</td>';
#            } else {
#                print '<td style="text-align: center;">&nbsp;</td>';
#            }
            if ( $album[$i] {'access'} -> {"every"} ) {
                print '<td style="text-align: center;">X</td>';
            } else {
                print '<td style="text-align: center;">&nbsp;</td>';
            }
            if ( $album[$i] {'access'} -> {"nathan"} ) {
                print '<td style="text-align: center;">X</td>';
            } else {
                print '<td style="text-align: center;">&nbsp;</td>';
            }
        }
        print "</tr>";
    }
}

Anyhow, I'd get ~15-20 rows then it will cut off mid string literal.
Code:
...
<td style="text-align: center;">X</td><td style="text-align: center;">X</td></tr>
            <TOut of memory!
R>
            <TD><a...
(Line 205)
And it also ends the output a bit early.
What's going on?
 
Could be down to your webserver configuration?

What sort of configuration have you? Is this on your web host or on your client machine?

Or it could be down to memory management. If your serving data (eg images) try destroying the variable after serving it

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Solved. I had the loop extend to one past the end of the array ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top