Alpha2: memory bugs
by Adam Johnston · in Torque Game Builder · 01/04/2006 (9:09 pm) · 61 replies
Hi everyone:
I am using the new alpha2 and I got two new kinds od crashes :(
This one happens when the frame rate drops a lot (lots of particles and
objects being created and deleted)
I am using the new alpha2 and I got two new kinds od crashes :(
This one happens when the frame rate drops a lot (lots of particles and
objects being created and deleted)
Memory::treeRemove(Memory::FreeHeader * hdr=0x06b446e0) Línea 466 + 0x9 C++
Memory::free(void * mem=0x06b446d0, bool array=false) Línea 930 + 0x9 C++
operator delete(void * mem=0x06b446d0) Línea 1106 + 0xb C++
t2dParticleEmitter::clearGraphSelections() Línea 129 + 0x23 C++
t2dParticleEmitter::~t2dParticleEmitter() Línea 119 C++
t2dParticleEmitter::'scalar deleting destructor'() + 0x2b C++
SimObject::deleteObject() Línea 389 + 0x33 C++
t2dParticleEffect::clearEmitters() Línea 366 + 0x19 C++
t2dParticleEffect::~t2dParticleEffect() Línea 85 C++
t2dParticleEffect::'scalar deleting destructor'() + 0x2b C++
SimObject::deleteObject() Línea 389 + 0x33 C++
t2dSceneGraph::processDeleteRequests(bool forceImmediate=true) Línea 2351 C++
t2dSceneGraph::updateScene(float elapsedTime=0.046999998) Línea 2502 C++
t2dSceneTicker::advanceTime(float elapsedTime=0.046999998) Línea 243 + 0x1a C++
clientProcess(unsigned int timeDelta=47) Línea 69 C++
DemoGame::processTimeEvent(TimeEvent * event=0x0012fa60) Línea 607 + 0x9 C++
GameInterface::processEvent(Event * event=0x0012fa60) Línea 71 + 0x11 C++
GameInterface::postEvent(Event & event={...}) Línea 153 + 0x11 C++
TimeManager::process() Línea 1231 + 0x17 C++
DemoGame::main(int argc=3, const char * * argv=0x010badb0) Línea 420 C++
run(int argc=3, const char * * argv=0x010badb0) Línea 1148 + 0x1a C++
WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, char * lpszCmdLine=0x00141f05, HINSTANCE__ * __formal=0x00000000) Línea 1214 + 0x17 C++
WinMainCRTStartup() Línea 251 + 0x1d C
#42
01/09/2006 (9:30 am)
A FreeListChunker + linked list would have very good memory characteristics for this sort of application.
#43
The reason I suggest a linked list, though, is that it seems like a lot of the effort in the above routine is to avoid one of the defining characteristics of vectors -- that they can reallocate the memory they're using. DataChunkers, OTOH, keep your memory in place. Using a DataChunker (ala a linked list) would allow you to use smart pointers again and would allow you to avoid the vector copy operation. In the end these aren't huge efficiency losses, but they seem unnecessary. (I guess I would also worry about things like what happens if someone assigns themselves an id already in use, how does the system deal with it and how will it deal with it in 1 year).
I think you can do what you want using linked lists. If an item doesn't need to be deleted this round, simply skip over it and just make sure all the links are maintained correctly. No need to iterate through the list multiple times since items can be safely added to the back of the linked list as you work on it as long as you always maintain the links correctly.
But again, if it works it works.
01/09/2006 (4:46 pm)
Well, if it works it works. The reason I suggest a linked list, though, is that it seems like a lot of the effort in the above routine is to avoid one of the defining characteristics of vectors -- that they can reallocate the memory they're using. DataChunkers, OTOH, keep your memory in place. Using a DataChunker (ala a linked list) would allow you to use smart pointers again and would allow you to avoid the vector copy operation. In the end these aren't huge efficiency losses, but they seem unnecessary. (I guess I would also worry about things like what happens if someone assigns themselves an id already in use, how does the system deal with it and how will it deal with it in 1 year).
I think you can do what you want using linked lists. If an item doesn't need to be deleted this round, simply skip over it and just make sure all the links are maintained correctly. No need to iterate through the list multiple times since items can be safely added to the back of the linked list as you work on it as long as you always maintain the links correctly.
But again, if it works it works.
#44
Thanks guys!
- Melv.
01/09/2006 (5:18 pm)
I certainly don't like the use of vector here, it's a hangover from a while back. FreeListChunker, I've never used that before; I'll go have a look at it.Thanks guys!
- Melv.
#45
just in case I rechecked your post and copy paste
the code of the fix, but now my game is crashing
even early...
just when I shoot a gun, and the projectile is going to dissapear
the engine crashes for me... Is there something additional to do?
This new crash is like this:
SimObject::getIdString() L
01/09/2006 (5:26 pm)
Hi Melv, maybe I'm doing something wrongjust in case I rechecked your post and copy paste
the code of the fix, but now my game is crashing
even early...
just when I shoot a gun, and the projectile is going to dissapear
the engine crashes for me... Is there something additional to do?
This new crash is like this:
SimObject::getIdString() L
#46
I'm not confident enough to make the significant number of changes required. My email address is bursar at phils pc mods dot com (just remove the spaces in the domain name).
Please post here if you send it, I don't want to end up with half a dozen emails! Thanks :)
01/10/2006 (3:31 pm)
As I posted in another thread I'm starting to experience this problem now. If anyone has recompiled Alpha 2 with the code changes and it works OK, is there any chance you could email me a release .exe of it please?I'm not confident enough to make the significant number of changes required. My email address is bursar at phils pc mods dot com (just remove the spaces in the domain name).
Please post here if you send it, I don't want to end up with half a dozen emails! Thanks :)
#47
01/10/2006 (4:35 pm)
Sent it
#48
01/10/2006 (4:43 pm)
Got it. Thanks a lot :)
#49
could you sendme your t2d.exe please?
01/10/2006 (5:51 pm)
@Toby: Are you using onWorldLimit in your code, if socould you sendme your t2d.exe please?
#50
01/11/2006 (3:50 pm)
@Melv: are you still chasing this bug?
#51
01/13/2006 (3:48 pm)
Seems I'm alone here :(
#52
You can be assured that I don't ignore stuff like this. ;)
- Melv.
01/13/2006 (3:59 pm)
I had to go to Germany last minute so unfortunately I've not had any time to continue my work on this. Now that I'm back I can continue but in the morning when I'm not so sleepy from travelling.You can be assured that I don't ignore stuff like this. ;)
- Melv.
#53
The above problem seems to have definately been fixed. If you have a crash situation, could you send me an updated "demo_crash" or something similar?
- Melv.
01/13/2006 (6:54 pm)
@Adam: I have tried the "demo_crash" app you sent me using an executable with the above changes and whereas it crashed using both methods you mention in the contained instructions, it now doesn't crash at all.The above problem seems to have definately been fixed. If you have a crash situation, could you send me an updated "demo_crash" or something similar?
- Melv.
#54
01/13/2006 (7:04 pm)
@Melv: OK Melv I'm going to send you an updated version.
#56
I will send it to you today 6PM or so (-5 GMT)
01/13/2006 (8:31 pm)
Sorry Melv, I need to add certain code and because I downgraded to the alpha2I will send it to you today 6PM or so (-5 GMT)
#57
verify my build, something was wrong because your exe wasn't crashing...
@Melv: glad I'm not going to waste more of your precious time in this "bug" ^_^
so you could rest a while and think in more wonderful feats for T2D progy...
I rechecked every step, starting from T2D alpha2, added your FIX, added my additions
and verifying in every step if my program was crashing or not, I was sure was something
in my side because Toby send me a exe that was working...
I don't have a clue why this didn't work monday, my only guess is maybe VC7 didn't
update some object files or I made something really wrong, but whatever...
seems it's working now!!
Thinking that you solved this in just two days, you are terrific man
Seriously :) THANK YOU VERY MUCH.
Something different: I found this "fix" in the forums: (winWindow.cc : 1228)
I don't know if this speeds up the exe, because with this my program
was more slowly quiting the levels, although I'm not sure.
I left the value in 2 now.
01/13/2006 (11:33 pm)
@Toby: Thanxs for send me your exe, it was the tip I needed toverify my build, something was wrong because your exe wasn't crashing...
@Melv: glad I'm not going to waste more of your precious time in this "bug" ^_^
so you could rest a while and think in more wonderful feats for T2D progy...
I rechecked every step, starting from T2D alpha2, added your FIX, added my additions
and verifying in every step if my program was crashing or not, I was sure was something
in my side because Toby send me a exe that was working...
I don't have a clue why this didn't work monday, my only guess is maybe VC7 didn't
update some object files or I made something really wrong, but whatever...
seems it's working now!!
Thinking that you solved this in just two days, you are terrific man
Seriously :) THANK YOU VERY MUCH.
Something different: I found this "fix" in the forums: (winWindow.cc : 1228)
if(event.elapsedTime > 0) //2) <-- this does something???
{
gTimer.advance();
Game->postEvent(event);
}I don't know if this speeds up the exe, because with this my program
was more slowly quiting the levels, although I'm not sure.
I left the value in 2 now.
#59
01/20/2006 (10:20 am)
I've just replaced T2D with the Alpha 3 (not b) executable and everything is running normally. Hoorah to everyone for squashing this :)
#60
I just wanted to add a comment in here --
I'm still using T2D Alpha 1 (due to the ridiculous number of added-in things I've taken from the community and done m'self that I don't feel like porting to a new version AGAIN unless I really really really really need the new functionality in the engine), and I'd just like to say that this thread should be heralded as THE reason to use garagegames' products...
Not because the bug was found, and discussed, and squashed (all of which are very nice things), but because months later I can search for "simset delete" and the mighty googlebox will direct me here... to the forums, where the actual code needed to solve my troubles has been provided verbatim by the main developer of the engine itself.
My crash was all but informationless... even the call stack was cryptic and sometimes here and sometimes there... debugging these things takes WAY more time than it took me to discover this thread and implement the fix.
Everyone who has contributed to this thread has just been elevated to the status of "Olympian God", in my book. Thank you all. ** tosses a handful of firstlings into the fire he's got going on the computer desk **
-Tim
03/01/2006 (4:37 am)
I know... resurrecting an old thread... I just wanted to add a comment in here --
I'm still using T2D Alpha 1 (due to the ridiculous number of added-in things I've taken from the community and done m'self that I don't feel like porting to a new version AGAIN unless I really really really really need the new functionality in the engine), and I'd just like to say that this thread should be heralded as THE reason to use garagegames' products...
Not because the bug was found, and discussed, and squashed (all of which are very nice things), but because months later I can search for "simset delete" and the mighty googlebox will direct me here... to the forums, where the actual code needed to solve my troubles has been provided verbatim by the main developer of the engine itself.
My crash was all but informationless... even the call stack was cryptic and sometimes here and sometimes there... debugging these things takes WAY more time than it took me to discover this thread and implement the fix.
Everyone who has contributed to this thread has just been elevated to the status of "Olympian God", in my book. Thank you all. ** tosses a handful of firstlings into the fire he's got going on the computer desk **
-Tim
Employee Melv May
Unfortunately, I do need random access or at least, need to be able to leave certain objects alone if they're not ready to be deleted. When a delete-request has been added, some objects in the list need to stay in it for several frames because they're not ready to be deleted; particles are one such object as they can be told to wait until all existing particles have expired.
The good thing is that it's working now; I didn't take into account the fact that the vector will relocate objects that need to stay in one place because of referencing.
If there's a simpler method of handling this situation though, I'm far from beyond learning how to use some core construct to help out here. :)
I'll have a look at the data-chunker class; I don't believe I've ever used it.
- Melv.