Jump to content
xisto Community
Sign in to follow this  
gaea

Argh! Javascript Memory Leak! Any help fixing this would be very much apreciated.

Recommended Posts

I've been working on a pet project. It's pretty much complete, but (to my horror) has a giant memory leak in it. I'm not really all that familiar with memory leaks. I've read a few articles on the subject, but I don't think any of the causes they listed (once i got past all the technical jargon) are the source of my problem. Then again, it's possible I missunderstood something. If anyone could help me fix this it'd be very very much aprecated. Also, if you could avoid using convaluted jargon in your explination it'd be helpful. I've been programming off and on for about four years now, but know next to nothing about Javascript memory leaks/interactions between JS and the DOM, etc.

 

A "working" (quote on quote) version of this page/problem can be found here: http://forums.xisto.com/no_longer_exists/ (I use my Xisto account for my serious political work, and so wanted another server for these kinda side projects).

 

The main page is just a frame set. There are three frames: the main page, the script page, and the redirect page. Once the script is finished only the main page will be visiable, but as of now the redirect page is shown to aid my troubleshooting.

 

Now for the code.

 

Frameset, e.g. index.html:

<html><head></head><frameset rows="60%,0%,40%" frameborder=0 border=0 framespacing=0><frame src="main.html" name="main"><frame src="blank.html" name="script"><frame src="blank.html" name="change"></frameset></html>

Main.html contains basic info, an input box (whose value is modified by script.php), and a button to launch script.php.

<html><head></head><body bgcolor="white" text="black"><table border=0><tr><!-- AD SECTION --><td width=10%><br /> <br /> <br /> <br /> <br /> 		<style type="text/css">	.adHeadline {font: bold 10pt Arial; text-decoration: underline; color: blue;}	.adText {font: normal 10pt Arial; text-decoration: none; color: black;}	</style>	<script type="text/javascript" src="http://4.adbrite.com/mb/text_group.php?sid=97369&br=1&dk=776569676874206c6f73735f365f32"></script>	<p />	<div><a class="adHeadline" target="_top" 	href="sitescout.com/adbrite/?utm_source=adbritemb/commerce/purchase_form.php?opid=97369&afsid=1 Ad Here</a></div></td><!-- END AD SECTION --><td valign="top" width=80% style="padding:15px;"><center><img src="title.jpg"><br /> <br /><font style="font-family: times,arial,verdana; font-size: 18pt;"><b>Step 1: Login to Gaia:</b></font><br />You may also login to your account via the Gaia homepage (make sure the stay logged in box is checked) and then come back here and continue, if you'd prefer.<br /><iframe src="login.html" width=95% height=230 frameborder=1>If you can see this it means that your webrowser doesn't support iframes.  Just login to gaia and then come back to this page.</iframe><br /> <br /><br /><font style="font-family: times,arial,verdana; font-size: 18pt;"><b>Step 2: Click the button below:</b></font><br /><form><input value="Run" onclick="parent.script.location='script.php'" type="button"></form><br />That's it! Now just leave this window open (you can minimize it if you want though) and it'll continue to automatically make gold for you!<br />You've made about <form name="runCount"><input size="10" name="totalClicks" align="center" type="text" value="0"></form> Gold so far!</center></td><!-- AD SECTION --><td width=10%><br /> <br /> <br /> <br /> <br /> 	<style type="text/css">	.adHeadline {font: bold 10pt Arial; text-decoration: underline; color: blue;}	.adText {font: normal 10pt Arial; text-decoration: none; color: black;}	</style>	<script type="text/javascript" src="http://4.adbrite.com/mb/text_group.php?sid=97369&br=1&dk=776569676874206c6f73735f365f32"></script>	<p />	<div><a class="adHeadline" target="_top" 	href="sitescout.com/adbrite/?utm_source=adbritemb/commerce/purchase_form.php?opid=97369&afsid=1 Ad Here</a></div></td><!-- END AD SECTION --></tr></table></body></html>

Script php randomly grabs a url from a text file and then redirects the "change" frame to it. It also updates the value of the form in main.html.

<html><head><meta http-equiv="refresh" content="2.5"></head><body bgcolor="black" text="red">  <?php	function getRandomLine() 	{	$lines = file('urls.txt');	   $line_number = mt_rand(0,sizeof($lines)-1);	  $killreturn=$lines[$line_number];	$location=str_replace("\n", "", $killreturn);	$location=str_replace("\r", "", $location);	print "parent.change.location=\"$location\";";	}  ?><script language="javascript"><!--var grabVal=parseFloat(parent.main.document.runCount.totalClicks.value);grabVal = grabVal + .25;parent.main.document.runCount.totalClicks.value=grabVal;<?php 	$lines = file('urls.txt');	  $line_number = mt_rand(0,sizeof($lines)-1);	  $killreturn=$lines[$line_number];	$location=str_replace("\n", "", $killreturn);	$location=str_replace("\r", "", $location);	print "parent.change.location=\"$location\";";?>//--></script></body></html>

Any help would be very much apreciated!

 

Thanks,

--Paolo

Edited by gaea (see edit history)

Share this post


Link to post
Share on other sites

*hopeful bump* Does anyone have an experience with this sort of thing? I'm really rather at a loss. If anyone could help i'd highly appreciate it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.