Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Is this a Memory Leak issue??

Author
Message
Game Builder
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Salem, Mass
Posted: 25th Nov 2008 15:01
I compile my code and it compiles and runs fine, but when I try to compile it the next time, I get the following error(s)

"object number not found:1004"

followed by

"Runtime Error 7008 - Object does not exist at line 32"

Then I just hit F5 to compile and run again and it works fine again. So basically I get this erroneous error every other time I compile. So I thought this must mean that some object/variable is staying in memory or something like that?

Now I realize that I could just keep hitting F5 twice each time I compile, but this is the sort of thing that nags at me in my sleep.

Anyone know what causes this? Is there a command that tells DBPRO to wipe all variables, objects, data, etc from memory at program termination? Is this a memory leak problem??

I am not sure if you need it or not but here is the line(s) in question. I included the line #'s




Mark the GameBuilder
[url]www.GameBuilder.org[/url]
RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 25th Nov 2008 15:26
My only idea would be that bird(1) to bird(4) arent all loaded, and sometimes it randomly hits the right numbers, but the other time one of those is not an object?...

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Nov 2008 15:45
I can see a probable 'object already exists' error in your code.

Your target objects number from 4 upwards. Your source objects number from 1 to 4. That's an overlap at object 4.

This is one of the reasons I was against RND being truly random - you'll get problem only every-so-often. Whenever I'm using random numbers myself, I always include a 'RANDOMIZE 1' at the top of my program to rule out the effects of randomness - I can always remove it if necessary when I'm done.

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 25th Nov 2008 15:59
So woud the fix here be to check if x=v and if so subtract 1 from V? You could get another random number but I would think that just making v=3 any time both v & x = 4 sould suffice.



"When I look at that square... I wish FPSC noobs would stay on their side of the forums and stop polluting these boards." - Benjamin
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Nov 2008 18:43
I guess that the fix would depend on the program itself.

If there are actually 4 objects that need to be cloned from, just changing the 4 to a 5 in the for loop would fix it. Otherwise, changing the 3 to a 2 in the RND command would reduce the range of numbers generated to 1..3.

RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 25th Nov 2008 18:46 Edited at: 25th Nov 2008 18:47
Quote: "Your target objects number from 4 upwards. Your source objects number from 1 to 4. That's an overlap at object 4.
"

oh yeah didnt see that...

@zenassem:
I think the solution is to start with x=5 (?)


Edit: ok Ian was faster

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 25th Nov 2008 20:25
Quote: "@zenassem:
I think the solution is to start with x=5 (?)
"


lol! I made a stupid assumption!

"When I look at that square... I wish FPSC noobs would stay on their side of the forums and stop polluting these boards." - Benjamin
Game Builder
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Salem, Mass
Posted: 30th Nov 2008 20:56
DOH! lol

Mark the GameBuilder
[url]www.GameBuilder.org[/url]
Game Builder
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Salem, Mass
Posted: 5th Dec 2008 23:07
Actually, for what I am working towards, the solution looks to be changing the rnd to 2 instead of 3. There are 3 basic penguin models being used and the rest are randomly generated off of them.

When I use the statement rnd(2) that means I will get between 0 and 2 right? So rnd(2)+1 will give me a # between 1 and 3, which is what I need.

I was so busy looking at the penguin assignment loop, I never even thought of the rnd(). Actually the rnd() in most basic languages function that way I think, but I have been out of the basic business for a while.

Thanks to everyone who offered helpful advice.

Mark the GameBuilder
[url]www.GameBuilder.org[/url]
Those who like to flame can *&%# a &*$@ with a twisted &%*$#

Login to post a reply

Server time is: 2024-11-24 16:52:21
Your offset time is: 2024-11-24 16:52:21