very simple webpage causing fatal memory error

I am making a very simple webpage to display my VFX demo reel. You can see what I’ve got at melissawhitcomb.com/main.php. I’m using a bit of PHP to change the content of the center of the page.

[php]<?php

set_include_path(‘melissawhitcomb.com/public_html/code’);

include(“code/header.shtml”);

include(“code/buttons.shtml”);

echo ‘

’;
$content = $_GET[‘content’];
if ($content) {
include($content);
} else {
include(“code/comp_reel.shtml”);
}
echo ‘
’;

include(“code/footer.shtml”);

echo “memory_get_usage = “. memory_get_usage().”
\n”;
echo “memory_get_peak_usage = “.memory_get_peak_usage().”
\n”;

?>[/php]

memory_get_usage and memory_get_peak_usage are returning 91192 bytes and 108632 bytes respectively, but I am getting "
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 331710352 bytes) in Unknown on line 0".

I’m totally confused since it doesn’t seem like I’m trying to allocate nearly that much memory. However, the page is working perfectly (in Firefox and Chrome, haven’t tested others yet) except for the error appearing at the bottom. I tried using ini_set() and error_reporting(0) to stop visitors from seeing the message, but they had no effect. Adding text to .htaccess caused the page to not load.

I would really like to get this solved as soon as possible and any help is greatly appreciated.

Thanks,
Melissa

Well, I think you have to “RELEASE” the memory when one video is loaded and played.
Then, you have to set it to zero.

Since you did not show any code, just includes, I am not sure what to set to zero…

Here is a link about this problem. Not sure if it will help, but, hopefully it will…
http://stackoverflow.com/questions/1145775/why-does-this-simple-php-script-leak-memory

Also, by the way, I loved the 3d graphic videos on your test site… Intrigued!

Thank you for replying (and for the compliment)!

The rest of the site is just HTML/CSS so I didn’t think it was necessary, but I included it at the bottom of this post.

I tried using unset($content) after the else, but it didn’t fix it. Isn’t unset() only for objects…? I’m afraid I’m still totally baffled, and any help would be greatly appreciated.

header.shtml

[code]

Melissa Whitcomb

Melissa Whitcomb

Compositor & 3D Artist
Los Angeles

[/code]

buttons.shtml

[code]

Compositing Reel 3D Reel Credits Resume Contact
divider
[/code]

comp_reel.shtml

[code]

Compositing Reel

Demo Reel on Vimeo. Last updated 1/22/12.

Shot Breakdown

[/code]

3D_reel.shtml

[code]

3D Reel

Demo Reel on Vimeo. Last updated 1/22/12.

[/code]

credits.shtml

[code]

  • Nazis at the Center of the Earth (video) — digital compositor (2012)
  • Grimm's Snow White (video) — digital compositor (2012)
  • Monstrum (short) — digital effects (2012)
  • 2-Headed Shark Attack (video) — digital compositor (2012)
  • The Amityville Haunting (video) — digital compositor (2011)
  • 11/11/11 (video) — digital compositor (2011)
  • Zombie Apocalypse (TV movie) — digital compositor (2011)
  • 3 Musketeers (video) — digital compositor (2011)
  • Dragon Crusaders (video) — digital compositor (2011)
  • Drive Angry — cgi artist (2011)
  • The Mechanic — digital compositor (2011)
  • The Solo Adventures (video short) — digital artist (2010)
[/code]

resume.shtml

[code]

whitcomb_resume.pdf (New Page)

[/code]

contact.shtml

[code]

Melissa Whitcomb
770-655-3684
[email protected]

IMDB Profile (New Page)

[/code]

footer.shtml

[code]

divider

Melissa Whitcomb • [email protected] • 770-655-3684

[/code]

newstyle.css

[code]/*

  • black = #000000
  • pale pink = #E2D9CC
  • eggshell = #F2E4E0
  • plum = #32111F
    */

/* global */

  • {margin: 0;}
    html, body {height: 100%;}

body {
background-color: #000000;
color:#E2D9CC;
font-family: verdana, arial, sans-serif;
font-size: 14px;
padding: 0px;
margin: 0px;
}

#center {
margin-left:auto;
margin-right:auto;
width:850px;
}

#content {
position: relative;
z-index:1;
}

h1, h2 {
font-weight:normal;
padding-bottom: 5px;
padding-top: 5px;
}
h1 {
font-size: 24px;
}
h2 {
font-size: 18px;
}
h4 {
font-size: 10px;
}
a {
color:#F2E4E0;
}

#buttons{
float:left;
}
#buttons a {
margin: 10px;
}
#footer {
text-align: center;
}
#footer img {
margin: 10px 0px 10px 0px;
}

#video {
padding: 10px;
padding-left: 20px;
margin: 10px;
margin-left: 20px;
}

.clear {clear: both;}

[/code]

Thank you for the extra codes. I loaded it all up on my server and it worked without any odd memory issues. I didn’t have the original code that posts the php code… I do not see where the error could be coming from unless it is from the “content” that is posted.

Have you tried to set all error messages to on to see if there is another hidden error message???

You do this with this code at the beginning of the PHP code:
[php]
error_reporting(E_ALL);
[/php]
I am at a lost on this one. One other thing you could try. Bring up the error so it is showing, then view-source of the page and see if there is something odd in what you see there. Sometimes you can see a repeating code from the CSS or other issues that do not show up until after the PHP is rendered back to browser. Might help… Sorry, I do not have a solution for you.

No hidden error messages… Nothing funny when I look at the code from the browser. Also, I can’t reproduce the error on my testing server.

I think I will be copying and pasting when I get home tonight so that I have functioning XHTML/CSS instead of continuing to screw around with this.

Thank you for your help.

Melissa

I did have an odd thing happen on my site.
Nothing to do with your code, but, might be something to look into.

I found that my server is a “Virtual” server. Which basically means that they have one server and hundred of websites on it based on the Domain Names. With these kinds of servers, they limit the memory which is used for the site. I check this and mine has 64Megs that the site can use. So perhaps it is something to do with the type of server being used.

If it is a dedicated server, you can alter how much memory is used. I have a local server (Microsoft Server) here and looked at it’s setup. I can alter how much memory it allows per site. So, perhaps you can just get your server people to boost it up a little.

Anyway, good luck. Sorry I didn’t have a solution for you! CYA in the bitstream…

Sponsor our Newsletter | Privacy Policy | Terms of Service