Author Topic: league out of memory error  (Read 9831 times)

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« on: December 23, 2006, 01:36:45 PM »
I reran the F1 league for 2 1/2 days before it crashed, then I realised I hadn't updated DB from .9o.  

Downloaded DB .9r...

This time it all seemed to run a bit faster and after only ~6hrs, match 12, DIN2 v Kyushu I got an error, out of memory message. (run-time error 7, out of memory then appeared when I closed first error message)(then I got a send this to MS? error message after closing second message)

Round 1 of 5
DIN2 0 - 11
Kyushu 0 - 7

Error.sim attached in case it provides any clues. I'll rerun the league tonight to see if it happens again.
« Last Edit: December 23, 2006, 01:38:18 PM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
league out of memory error
« Reply #1 on: December 23, 2006, 05:25:01 PM »
yea, I've been chasing this one for a while now.  I've got a slow memory leak somewhere.  I don't think it is specific to leagues.  It takes days to hit when running in the debugger, which I am doing now.   Hopefully, I can get it to crash this weekend...
Many beers....

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« Reply #2 on: December 23, 2006, 08:19:44 PM »
Good to know you have a handle on this problem already.

Took 9 bot entries this time btw, interupted S. Conquistador's climb to the top. I'll do it one more time, in case it is something that leaks more when rerunning the leagues and you have trouble tracing it. I figure if I can get the problem three times in less than six hours each time then an F1 league rerun might be a quicker way to find.

I'm sure I have asked and had an answer to this before    but is there a way I can run this debugger as well and provide you with more specific fault finding info than I am atm? Seems a shame to leave you spending days to find the info needed to fix faults if there is a way to (even partially) share out the workload in some way.
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
league out of memory error
« Reply #3 on: December 23, 2006, 11:41:27 PM »
Quote from: Jez
I'm sure I have asked and had an answer to this before    but is there a way I can run this debugger as well and provide you with more specific fault finding info than I am atm? Seems a shame to leave you spending days to find the info needed to fix faults if there is a way to (even partially) share out the workload in some way.
Sure, if you like.  All you really need to do is download the source code and install a copy of VB6.  VB6 is an IDE - an Integrated Development Evironment, the precursor to today's Visual Studio - that means it includes an editor, debugger, compiler, etc. all in one.  So when I say I'm running DB "in the debugger" or "in the IDE" what I mean is that I'm running the program "inside" Visual Basic using the VB interpreter to interpret  the basic source code in real time instead of instead of running the compiled executable like most people do.  This real-time source code interpretation is one reason running "in the IDE" is perhaps 10X slower than running the compiled code and why it can take so damn long to find certain kinds of problems.

All you need to do is use VB to open and load up the DB VB project file (called Iersera.vbp) and hit the play button (or F5) in VB6.  This will start DB like normal, just running "within" VB6.  Now when there's a crash, VB will catch it (usally) and tell you on what source code line the problem is occurring (though often the actual root cause of the problem lies somewhere else and takes soem analysis to determine just why the code is doing what it is doing.)

There are a few additional things to be aware of.  In particular, there are a few places where exception handling logic in the source code should be disabled when running in VB so as to let VB handle the problems instead of the code itself.  Makes for cleaner debugging.  Then there are the many tips and tricks to debugging - breakpoints, watch expressions, etc. - but just getting VB6 installed and the source code running is the big hurdle and the first main step.  Let me know if/when you want more info on the rest of the details.  Cheers.
Many beers....

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« Reply #4 on: December 24, 2006, 08:49:47 AM »
Where do I find the latest source code pls, only seem to be able to find it for C++
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
league out of memory error
« Reply #5 on: December 24, 2006, 10:14:19 AM »
Quote from: Jez
Where do I find the latest source code pls, only seem to be able to find it for C++

source code for 2.42.9r
http://www.darwinbots.com/FTP/Darwinsource2.42.9r.zip

thanks eric ... these are most helpful to have.

if you still need VB6:
http://www.darwinbots.com/FTP/VB6.zip
you may get some error messages when installing ...
ignore them ... it's stuff you don't need.


attempted to get a Debugging page happening on the WIki ...
hoping to have a place where 'seasoned' debuggers could give some
tips to we newbies ...
help us finger out some tricks using VB ...
so we could then help debug ...
but nothing ever came of it.
the page is still there ...
and still a good idea, imo.
http://www.darwinbots.com/WikiManual/index...title=DeBugging
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« Reply #6 on: December 24, 2006, 12:38:24 PM »
Thanks Griz

Didn't know we had a wiki page for debugging, I was thinking of collating all the info I get on doing it myself, seeings as I'll need most of it explained to me. I'll try to add the info to that page. How do I get to the place where the source is available? Otherwise I'll have to ask for link for each update.

Eric,

I have VB and source now, have managed to get DB to run in debugging mode and even found one bug, which didn't seem worth bothering you with so ignored it.

Any more tips would be welcome now...  

Edit
Link on how to Bug Report when you find bug

Edit
Just noticed Ieserva is running .9q not .9r as well. Hope that won't matter.
« Last Edit: December 24, 2006, 01:29:23 PM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
league out of memory error
« Reply #7 on: December 24, 2006, 02:08:04 PM »
Cool.  Glad to have you helping out!

The link to the source code download page is at the bottom of the main Downloads Page.

Please tell me about the bug you found.  Every little fix helps.

So, search the entire source for the string 'error.sim'.  You will find it about 6 times, but there are two lines where the comment portion of the source code line indicates that line should be commented out when running under the debugger.  Just put a single apostrophe at the beginning of the line.  This way, the source code won't try to handle the exception (an 'exception' is just a fancy name for a crash, a divide by 0 or something like that) and VB will get the error.  When an exception does happen, you should get a pop-up dialog that offers to let you debug the problem.  When you hit the debug button, it should hightlight the source code line where the exception is occurring.

Not much difference between 2.42.9q and 2.42.9r.  Pretty sure the memory leak is in both.

Setting a breakpoint on a specific line (the F9 button) and then stepping through the code line by line using F8 can be very useful in learning what is going on.  You can take a look at varible values in the watch window by adding 'watches' or execute your own source on the fly when VB is paused (e.g. print foo) in the immediate window.

Have fun playing around.  Feel free to ask questions!  Happy holidays.
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
league out of memory error
« Reply #8 on: December 24, 2006, 03:11:25 PM »
Quote from: EricL
So, search the entire source for the string 'error.sim'.  You will find it about 6 times, but there are two lines where the comment portion of the source code line indicates that line should be commented out when running under the debugger.  Just put a single apostrophe at the beginning of the line.  This way, the source code won't try to handle the exception (an 'exception' is just a fancy name for a crash, a divide by 0 or something like that) and VB will get the error.  When an exception does happen, you should get a pop-up dialog that offers to let you debug the problem.  When you hit the debug button, it should hightlight the source code line where the exception is occurring.
two lines?
I know of one here:

in MDIForm1 (code)
in Private Sub simload
~~~
Code: [Select]
Private Sub simload(Optional path As String)
  Dim I As Integer
  Dim path2 As String
  
 On Error GoTo fine ' Uncomment this line in the compiled version error.sim
~~~
comment this 'On Error' out when using VB and Debugger ...
or it will abort and go save the error.sim.

then remember to uncomment it once you have
located and fixed an error and want to recompile ...
or the recompiled prog won't do it's 'save error.sim'
[not that this has ever happened.  lol]

also ... once the debugger has sent you to the break ...
'hovering' the mouse over variables in the code will
give you their value at that time and place in the execution.
this is helpful in finding overflows or variables out of range.
using this, even I have been able to locate errors on occasion.

again ...
I urge those with VB and Debugging knowledge to use the Wiki
page to document some of the basics in this area.
the advantage of the wiki being ...
it can be continually updated/edited by any of us ...
and is always in the same place ...
not getting lost somewhere in the archive of posts here at
the forum.

I used to have a lot of pages there listing the codes
for various moduals and bug fixes when we were
trying to help out PY debug version 2.37.
they are now out of date ...
but still exist.
here's a couple of them to give you an idea of how
I started to go about it ...
just couldn't get anyone else to use them!
http://www.darwinbots.com/WikiManual/index...tle=Bug_Reports
http://www.darwinbots.com/WikiManual/index.php?title=Senses
http://www.darwinbots.com/WikiManual/index.php?title=Robots

the idea was to put the code out there so people could
ask questions about it, begin to see how it works ...
and perhaps get interesting in debugging/writing themselves ...
to perhaps start an interactive  VB and/or DB tutorial.
that was the plan anyway.

so maybe something like this would be useful ...
or perhaps someone has a better idea.
like I said, this can all be edited and changed to
make it whatever we want to make it ...
whatever works.
so check it out ...
see what you think ...
see what you can come up with ...
and if people are actually interested ...
then I could see getting behind it again and
investing more time and energy.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« Reply #9 on: December 24, 2006, 03:41:59 PM »
You were certainly right about it running slower in VB debugger; watching it reminds me of the old days!  

Bug; (let's see if the reporting is done right

Not having league folder ready when you try to run rerun league, choosing NO when it asks if you want to set up new league folder: Runtime error 5

Forms/LeagueForm(LeagueForm.frm)

Private Sub Write_Challenger()
  If Attacker >= 0 Then
->    Robname1(30).Caption = Left(LeagueEntrants(Attacker).Name, Len(LeagueEntrants(Attacker).Name) - 4)

****

When you say
Quote
search the entire source for the string 'error.sim'.
do you mean search all those windows (that nearly gave my finger RSI closing before I figured out I hadn't made a mistake and there was an easier way to close them) ??  
That's 20k lines of code if I remember right, I'm sure that's not what you meant...  

Quote
Setting a breakpoint on a specific line (the F9 button) and then stepping through the code line by line using F8 can be very useful in learning what is going on. You can take a look at varible values in the watch window by adding 'watches' or execute your own source on the fly when VB is paused (e.g. print foo) in the immediate window.
Causes me lots of problems in the understanding dept, sry but I might need a pre-school prep ABC before getting to grips with what you meant. On the other hand, perhaps when I have played about with it a bit more, I.e. locating watch window, I might get struck by lightning and be granted by the gift of many tongues, you never can tell.

2BH I have a 'learn VB in 21 days' book and a VB v4.0 disc but I never got past chapter 3 'cause my pc got a fresh install and I misplaced the disc for a year or two.   Never did get round to doing it again.  So that, and a little bit of basic C64 programming is the full extent of my experience.

***

If you peeps in the states (or elsewhere) are already into Xmax then Happy Xmas! If, like me, you have a few more hours to wait then Happy Xmas soon!!
(I'm having a happy holiday keeping Santa's glass topped up and taste testing it now and then to make sure nobody poisoned it while I wasn't looking.)  
« Last Edit: December 24, 2006, 03:42:33 PM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« Reply #10 on: December 24, 2006, 04:07:12 PM »
Griz,

(seeing as you ninja posted me!   )

Thanks for providing a guide to finding one of the error.sim bits, I shall go find that, can't see me wanting to recompile the code so I can forget about it then till next source drop.  

This wiki thingy; I have to admit that when I last returned to DB that updating the wiki was one of the top things on my to do list. Since then it has been buried under lots of other DB related to do things.
People like Eric or PY or Nums, while being the best people to do this, have lots of other things to do as well. It's like the first bestiary list, the one I am now trying to integrate into the existing bestiary, I created it by spending time surfing the old forums and collecting all the posted bots into one place.
While I would love to drag Eric away from his endless bug fixing to do a wiki update; I would also hate the time he spent updating the wiki as time lost for improving the game. (I.e. league improvements)
I think our programming clique are spending their time well, by improving DB, and that the more menial record keeping tasks are something that we can help with. (part of the reason I have offered to help with the bug location, seems silly for us to spend a day or two running a sim only to find a bug if Eric then has to spend the next 4 days locating the same bug so he can fix it!)

If you are volunteering to garner relevant bug location 'how to' advice and, even if it's just a copy/paste to begin, drop it into the wiki page you mentioned then you have my support, we can link it from the forum as well. I hope you do this, it would be cool to have all the advice in one place, even if someone has to come along after and do some minor editing it is quicker than them writing something from scratch.

If we ask the relevant, amateur questions, (in the forum which peeps who know will answer) then I think we are in the best postion to create an amateur 'how to' guide.
If there is anything I can do to help, as a non programming dude, then just say, I would be happy to assist.

Edit
Can I edit the source code while I am running a DB debugger? Or would I have to stop or pause DB first? (few hrs into F1 league rerun under debugger so quick answer appreciated if I have to stop it.)

Edit
What is the immediate window for?
« Last Edit: December 24, 2006, 04:25:32 PM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
league out of memory error
« Reply #11 on: December 24, 2006, 05:19:45 PM »
for searching ...

click on the 'binocular' icon on the VB toolbar ...
select what you want to search ... in this case 'project'.
that will step you thru all the moduals.

I found 5 error.sims ...
don't think I missed any ...
the only one seems relevant is the one I posted.

I haven't yet been able to sus out setting breakpoints either.

I hear ya about pulling PY/Nums/Eric away from what they are doing.
it would be great to be able to give them a hand debugging ...
but I'm certainly not any good at tracing back a problem to
it's source.
about all I can contribute is to locate where a variable is out
of range or some such thing ...
take that data and document in which modual and sub and
line it shows up.

the wiki idea was about keeping everything in one place ...
where everybody would have access to it ...
to the code and the changes made ...
which would then allow them to edit the code and recompile
themselves ...
in addition to being introduced to thr DB code and how it works.

how we want to do that ...
is up for grabs ...
I just started in hoping I would get some feedback as to how
we might go about it ...
but I don't think anyone ever even looked at any of it.
there were never any comments or anything ...
and it was a lot of work.
so I just gave it up.

how about this:
seeing we are playing with leagues right now ...
what if I go ahead and put the league code on the wiki?
then we can go thru it and have a place to ask questions
about the code, document bug fixes, ect ...
just as a way to perhaps begin ...
to see what kind of format we might be able to come up
with for debugging ...
as in the process I'm certain we will begin to pick up how
both VB and DB works.
that's what I'm interested in.
and hopefully eric/nums/py/others ...
might also give us some VB/Debugging tips on some page
there as well to get us started.

well ... that's the plan ...
in addition to the Debug page that's already there ...
http://www.darwinbots.com/WikiManual/index...title=DeBugging
where we can ask debugging questions ...
I'll do a page for League Code ...
http://www.darwinbots.com/WikiManual/index.php?title=Leagues
and we will see where it goes from there, eh?

If nothing else ...
'I' intend to learn something about VB/DB.

ah ... editing ... I would think you have to stop VB to do that.

immediate window and other windows?
I ain't got a clue.

all this can go on the wiki  on the Debugging page ...
I'll put it there as we find out.
and/or anyone who knows can go there and put it in ...
or raise any other questions.
doesn't matter what one puts there ...
it can all be edited.

so yeah jez ...
you can be a big help at the wiki ...
play with learning the wiki code/editing ...
I recall making a 'sandbox' page there for just such 'playing around'.
http://www.darwinbots.com/WikiManual/index.php?title=Sandbox
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
league out of memory error
« Reply #12 on: December 24, 2006, 06:49:02 PM »
Quote
for searching ...
click on the 'binocular' icon on the VB toolbar ...
Honest guv, I knew there was a way to do this and Eric wasn't telling me to hand search 20k lines of code.  

We don't need to trace a problem back to its source, just give them a better starter point. They are the programmers and that's all, hopefully, they need to shorten their job.    (As the estate agents say "Location location location")  

I am all for having a Wiki, that is the first thing I referred to when I wrote my last bots, unfortunately I had to update some of the information and surf the forum's for the updated info before it was useful.
Everything in one place, as I tried to do with the original bestiary, is a great goal. Unluckily we don't have someone who is willing to spend time keeping the 'newbie info' upto date. It was a goal I set myself, upon my return, that I failed to live up to, especially when I got made a mod and got my sticky fingers into the bestiary!  

I think part of the reason your page never got any hits/feedback was that it wasn't linked via a sticky or whatever in a relevant part of the forum. There is a sticky on debugging that I think I linked to earlier, it doesn't contain the info contained in all the links we have had in this topic though. (Can be changed)
I never noticed it when I was searching the forums for 'how to debug' info for instance.

Personally I wouldn't bother with a 'how to understand the code' we can't expect to provide peeps with a VB tutorial. Just give us the info, in one place, of how to provide the most relevant debugging info to the programmers. Understanding VB code is another topic, (should you be brave enough).

I have gave up, long agoe. expecting recognition for the time I have spent modifiying the forums or information, you may have noticed how thankful our programmers are for recognition of the effort they have spent fixing stuff, they don't get much and they spend a lot of time, behind the scenes, fixing it.
I sort of expected to get lots of extra post credits as well, re-sorting the bestiary/leagues, but instead most of my effort has been editing other peeps posts and running ...days long sims that crash before they finish!

Think carefully before you offer to do something for the DB experience, what I volunteered for has already proved to be 10X more work than I expected. An amateur guide to running the debugger is magnitudes different to getting untrained peeps to understand what the code means.

I would love to know that someone took an active interest in adding forum info to the wiki though. I really am hoping that you take an interest in this, so far unfufilled, goal.

Wiki has never seemed a sucessful place to ask questions or discuss things, that has always been more evident on the forums and lacked the proper feedback into the Wiki.

I will play more with the VB debugger, I am running a F1 rerun sim atm, hope that not removing the error.sim bits won't handicap me locating the bugs.

'though the effort might seem vain
it would not be the same
if the people in the wings
did not do their magic things
fix the broken stuff
make it work 'oh well enough'
rescue the idea
make it all more plain'
« Last Edit: December 24, 2006, 06:51:06 PM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
league out of memory error
« Reply #13 on: December 24, 2006, 09:42:28 PM »
the wiki stuff is my idea for learning DB/VB myself ...
a place to ask questions as they arise ...
to have it documented/archived, if you will ...
so that would then benefit anyone else who happened
along wondering the same thing.
in fact, wiki's are all about that ...
group participation.
but I'm a novice at it VB and debugging ...
so I need to have a little feedback ...
a little help, ie ... someone with answers
to the questions ...
or I don't get to learn anything either.
so that just never happened there ...
sometimes I don't think anyone knows the wiki exists.
I've linked to it many times in the past ...
but you'd be hard pressed to find them here ...
and never had any indication that anyone ever
even went to look.
a lot of folks did a lot of work there documenting
robot DNA and all the commands ...
Ollj was a major contributor ...
but I don't know if anyone actually used any of it ...
or that people even know it's there.

so I have no problem doing the grunt work of getting
the wiki pages set up so they can be a good source
of information ... and organizing that info ...
but if no one is going to participate in that ...
if no one is going to use it ...
then there's really not much point.

another thing was ...
it was mostly about VB code ...
and as soon as it was decided to go to C++ or whatever ...
interest in VB seemed to end ...
at least up until Eric began sorting it out.
that's what brought me back ...
otherwise it was going to be a dead end for me.

anyway ...
if I can get someone to answer some of the questions
as they come up ... to help some of us get up to speed
on debugging so we can lend a hand there ...
great.

we will see.

we need to get PY interested in 2.4.X ...
I don't think he liked abandoning 2.47 ...
and all of the bots he had worked so hard on.

so it goes
« Last Edit: December 24, 2006, 09:47:59 PM by Griz »
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
league out of memory error
« Reply #14 on: December 24, 2006, 09:46:59 PM »
oh yeah ...
1st problem I encountered with looking at
the code for leagues ...
man ... it's all over the place!
so I'm still searching to find where it lives
in the moduals ...
to see if I can get some idea of how it does
everything it does.

so any code snippets you find ... please add them to: http://www.darwinbots.com/WikiManual/index.php?title=Leagues
and I'll try to sort it out as we go.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]