unhandled exceptin : Unhandled Memory Exception
BlitzMax Forums/BlitzMax Programming/unhandled exceptin : Unhandled Memory Exception
| ||
hy :) i was programming and found it unhandled exceptin : Unhandled Memory Exception Error can anyone tell what is this? Because i'm lost! don't know if it's a internal blitzmax error or mine. Thanks :) |
| ||
Have you got debug switched on for a better error or any example code? |
| ||
ok, i've two lines inside a method blitzmax shows this error on the first line, if i comment the first line, it shows the same error in the second, if i comment the second, and add a third line, it shows the same error at the third line!!! i just don't know what's is it.. the code is big, a lot of bmx files, etc... lolz.. i dun know ... really dun thx |
| ||
Paste the offending lines here, else no one can help. |
| ||
I think there are a large number of posible causes for this, not all of them have to due with memory. For instance I had a divide by zero bug that caused the same error message. It was neccessary to put in print statements to find where the program was acutally bombing out. For fun if you are using FlushMem comment it out, if you aren't using it put it in the main program loop. Just to see if it makes a difference. |
| ||
well i've verified and i'm not makin division by 0.. i've already have commented and uncommented the flushmem lines.. and the error continues i've tried the print statements and it just showed me that the error is inside a single method that calls another two! because if i comment it, the error not happens anymore. But i'll have a NullPointer... =/ the lines are inside that method Method initGame () Print "a" Self.adminDepartament = AdminDepartament.createAdminDepartament( Size.createSize( 10, 10 ) ) Print "b" Self.clock = Clock.createClock( NORMAL ) Print "c" EndMethod and it justs prints "a" but if inside the method createAdminDepartament i put some print at the first line of it, it's NOT printed!!! it's like blitzmax abort the execution when the method is called... i just can't understand... thx :) |
| ||
I get these all the time. Very common when working with external functions which tries to write to "forbidden" parts of the memory due to passing faulty pointers or external functions using the wrong calling convention. External functions using the wrong calling convention can be tricky to spot sometimes since they can actually be called a couple of times until the stack is messed up. |
| ||
I'd say that you might be getting a null pointer reference in the Size.createSize() call. put some print statements in there to see if it gets all the way through. |
| ||
thx for the tip but i'm have verified and i'm not getting a null pointer in Size.createSize(). should i contact mark? lolz thx |
| ||
Also you should have all included files open in the ide, otherwise the debugger won t mark the error line if the error is in a file which is closed. It took time for me to realize that, lol. |
| ||
Double clicking on the entries in the debug window will open the file with the offending line. From personal experience I would check to see if you forgot a Return statement in your CreateSize function / method. |
| ||
ok guys I've tried oppened ALL the files and error continues without logical cause... I've verified all the methods that returns something and ALL the returns are there!!! no one missing!!! i can't understand... =/ thx |
| ||
put in a temporary variable like so and at the debugstop you can check to see what your variables are doing local size:TSize=Size.createSize( 10, 10 ) debugstop Self.adminDepartament=AdminDepartament.createAdminDepartament( size ) also, use Strict at the top of your program to avoid spelling mistakes and don't call your type and your instances the same name - (blitzmax is not case sensitive so adminDepartament and AdminDepartament are exactly the same token and so could mean a variety of things in the code above) Perhaps you meant to write Self.adminDepartament=TAdminDepartament.createAdminDepartament( size ) which would use the Type and not the uninitialized instance to locate the createAdminDepartament Function (it surely is not a method???) |
| ||
ok i used the DebugStop now and before it too... and all the values of variables are all correct!!! the Strict appears at the top of all files!!! yes it is a Function.. i've already verified it too... for all types envolved. i tried the TAdminDepartament and BlitzMax do not even compiled it. It said that the identifier TAdminDepartament wasn't found. i'm lost... thx |
| ||
Call your Type TAdminDepartment and your field AdminDepartment that way BlitzMax knows exactly what you are referring to. At the moment I think the compiler suspects you are actually wanting: self.AdminDepartment=Self.AdminDepartment.CreateAdminDepartment() which is causing a null pointer because the right hand side is using the null Self.AdminDepartment field not the TAdminDepartment type to locate the CreateAdmin function. |
| ||
thx i've tried it too, using self.AdminDepartment=Self.AdminDepartment.CreateAdminDepartment() but the error continue... =/ |
| ||
Did you change the name of the type and the field like Skids suggested? |
| ||
yes i have and the error continues... |
| ||
sorry I was a bit ambiguous, what you do want to do is this: self.AdminDepartment=TAdminDepartment.CreateAdminDepartment() |
| ||
me? i have an atribute (field) in my class (type) called adminDepartment : AdminDepartment when im calling AdminDepartment.CreateAdminDepartment() the function CreateAdminDepartment() returns me a new AdminDepartament instance. :) |
| ||
So, i put all my files in a host (http://www.insanegames.v10.com.br/all.zip) please, cold anyone help me, this is to my final project and i don't wanna convert to java (and learn java 2d...) Please! Tks by now! PS: The code is written in Brazilian Portuguese... |
| ||
Check the change of the typename in the code below... Jogo.bmx DepartamentoAdministrativo.bmx You will have to change the secreteria.bmx file as well since you will get the same error on that... Basically the problem is that you shouldn't have a type field with the same name as an existing type... like this line... Field secretaria : Secretaria |
| ||
yeah!!! :D thx that was the problem: "Basically the problem is that you shouldn't have a type field with the same name as an existing type..." thank you all for helping us out :D :))) |
| ||
ps: the code was removed from the server... when we finish the game it'll be opensource :)) and we'll public it here!!! ths a lot again :D |
| ||
Actually, it's what skidracer suggested all along but I guess you misunderstood him. :) |
| ||
Crazy !! I have the same problem !! Thank to this post I found the bug |