BMK in an infinite loop compiling this module

BlitzMax Forums/BlitzMax Beginners Area/BMK in an infinite loop compiling this module

Hotcakes(Posted 2004) [#1]
This module, placed in \mods\hot.mod\iff8svxloader.mod\iff8svxloader.bmx:

Appears to send BMK into an infinite memory consumptious loop ;] I left it running overnight because I just couldn't be bothered anymore and when I woke up in the morning Windows had popped up a low on virtmem error (keep in mind my max virtmem is set at 4gb:) and when I clicked OK to that, BMK promptly crashed. Ha!

So I'd like to know if I'm doing something horribly wrong or if it's a bug. Because I don't know any better.

It was compiling fine, before I put the For Local i=0 To... loop in. It used to just be the stream.readbytes command and that worked AOK. But I can't see anything wrong with the loop. It said in the docs that you can define a Local like that (in a For line) and I have Strict on so bmk will probably complain if I didn't... still... I don't see anything else that could be remotely classified as wrong. Help! =]


Kanati(Posted 2004) [#2]
Well... It's not BMK that's eating the mem... It's bcc.exe. But you are right. It'll gladly sit and spin. I changed the declare to be outside that loop and that isn't it.

Still looking........

Kanati

[EDIT #1]
Ow ow ow ow... sometimes even when the compile returns an error and you think everything is fine, bcc.exe sits and burns memory. And will sometimes hold on to the file.bmx.s file so successive compiles will return an error saying it couldn't find the file. I just had to clear out 5 running bcc.exe processes.

[EDIT #2]
Well this is your problem line:

		ReadLong(stream);ReadLong(stream)			' 4 unimportant Ints


Readlong is a function and returns a long... Obviously. But if you use it like you are, it blows the crap out of the compiler, sending it into a rainman-esque autistic rage. Change it to:

		Local l1:Long = ReadLong(stream);l1 = ReadLong(stream)			' 4 unimportant Ints


And it compiles fine. Definitely a bug in the compiler. At worst it should cause a syntax error in the compile.


Hotcakes(Posted 2004) [#3]
Ow ow ow ow... sometimes even when the compile returns an error and you think everything is fine, bcc.exe sits and burns memory. And will sometimes hold on to the file.bmx.s file so successive compiles will return an error saying it couldn't find the file. I just had to clear out 5 running bcc.exe processes.

Wow. I didn't get that one yet =]

And it compiles fine. Definitely a bug in the compiler. At worst it should cause a syntax error in the compile.

OK, Well blow me down and call me Charlie. I guess Max doesn't handle stack screwups as elegantly as B3D did ;] In previous Blitz's, as you no doubt know, you could call a function, not collect the result and have it discarded nicely.

Really strange thing is that if you take out all the Local definitions after t:TAudioSample, the code works and compiles 100% fine - but -one- more and the compiler goes haywire. Looks like I just pushed it over the edge.

Thanks for your help K, I would -never- have thought of that!