Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
particle effect causes Blue Screen #332761
07/12/10 00:22
07/12/10 00:22
Joined: Aug 2008
Posts: 26
Arkansas, USA
W
willjones Offline OP
Newbie
willjones  Offline OP
Newbie
W

Joined: Aug 2008
Posts: 26
Arkansas, USA
Hello, I am just beginning to play around with the "effect" function and it is working fine, however after about 20 or 30 minutes of playing with it my computer crashes! This has happened twice. I get the Blue Screen of Death error and it only shows for a couple seconds (not long enough to read any details) although later I did get a prompt from Windows showing me where to find a dmp file and sysdata.xml file. So, I'm not sure what's happening, but I wonder if its related to not enough memory or something. Is there a memory leak occurring? I just started out with the example "effect" code and then started tweaking it with different vectors and colors, etc. I'm not sure what would cause the crashing. Anyway, let me know if you have any thoughts. Thanks...


[A7 Commercial]
Re: particle effect causes Blue Screen [Re: willjones] #332762
07/12/10 00:37
07/12/10 00:37
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Check the debug panel if the memory consumption increases over the time (or check the Task Manager).
(You could post the code, too.)


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: particle effect causes Blue Screen [Re: Superku] #332763
07/12/10 01:06
07/12/10 01:06
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
there is no way engine can give you the BLUE screen, it is either for other reasons or your drivers(gfx,sfx,video codecs)


3333333333
Re: particle effect causes Blue Screen [Re: Quad] #332773
07/12/10 02:42
07/12/10 02:42
Joined: Aug 2008
Posts: 26
Arkansas, USA
W
willjones Offline OP
Newbie
willjones  Offline OP
Newbie
W

Joined: Aug 2008
Posts: 26
Arkansas, USA
Thanks, I did check my task manager and sure enough the memory consumption was increasing over time. I tried running the original sample code I found for trying out the effect and the memory consumption did not increase over time. So, not sure if it was this or not but it does seem clear my code has a memory leak somewhere. After experimenting with this a while again I noticed suddenly that the file called 'WDFME.exe' showed up in taskmgr with 100% CPU usage and the memory usage for that process was growing rapidly. I was unsure what to do so I terminated the process. After searching for this on google I discovered that corresponds to a My Passport disk I purchased recently to auto-backup all my files for me as they are written out. (I wonder if there may
be some kind of problem with it and the 3DGS engine? I don't know just guessing. ) The reason I say this is because I've had the My Passport drive for 2 or 3 weeks, but I'm only just now seeing this issue and have only recently started doing things with 3DGS. I've experienced this blue screen issue 3 times so far but this last time after terminating the WDFME.exe process its been over an hour and I still haven't seen it crash again. I found a link on google about the WD Smartware needing a Microsoft Update patch (KB 982524) which I don't have installed right now... so not sure if that is my problem here or not. Anyway, I'll continue investigating. Thanks for your help...


[A7 Commercial]
Re: particle effect causes Blue Screen [Re: willjones] #332775
07/12/10 03:30
07/12/10 03:30
Joined: Aug 2008
Posts: 26
Arkansas, USA
W
willjones Offline OP
Newbie
willjones  Offline OP
Newbie
W

Joined: Aug 2008
Posts: 26
Arkansas, USA
I think I discovered what was causing my memory leak. I was using the following function and calling it from inside my main loop...
Code:
function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}



So, basically it looks like it was creating vectors with the "vector" call over and over. So, this leads me to the question, how does lite-c do garbage collection? Can it be explicitly triggered. Clearly use of vector calls in a loop is bad though. Thanks. (Also by the way, I've installed the Windows Update patch and haven't seen any more blue screens since, so hopefully I'm good now.)


[A7 Commercial]
Re: particle effect causes Blue Screen [Re: willjones] #332776
07/12/10 04:34
07/12/10 04:34
Joined: Mar 2010
Posts: 14
Queensland, Australia
C
CoburnDomain Offline
Newbie
CoburnDomain  Offline
Newbie
C

Joined: Mar 2010
Posts: 14
Queensland, Australia
I was going to say that the Blue Screens could also be caused by faulty memory (RAM), but now that you've fixed the problem, I guess it's fixed. laugh

I'm not too sure how the engine does garbage collection, but I do know you can apply some tweaks to the compiliation to make it neater/optimised

Re: particle effect causes Blue Screen [Re: CoburnDomain] #332802
07/12/10 10:16
07/12/10 10:16
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
There is no garbage collection like in Java. If you allocate memory by yourself (using malloc or the like), you will have to free it yourself, too. If you allocate memory by creating predefined data types (such as VECTOR, ENTITY,...), the engine will handle to free the used memory when the function ends or when you close the application.
The vector command does not create a new VECTOR, there are (approx.) 32-64 vectors that are used consecutively.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: particle effect causes Blue Screen [Re: Superku] #332933
07/13/10 01:43
07/13/10 01:43
Joined: Aug 2008
Posts: 26
Arkansas, USA
W
willjones Offline OP
Newbie
willjones  Offline OP
Newbie
W

Joined: Aug 2008
Posts: 26
Arkansas, USA
So, I'm not sure if I understand, but I suppose this means if you do more than 64 calls to vector( ... ) something bad happens? Or is it supposed to just cycle back through and re-use them?

Could I do something like this, alternatively?
Code:
VECTOR* tmpVec = { x=0; y=0; z=0; }

function vector_tmp(var x,var y,var z)
{

   tmpVec.x = x;
   tmpVec.y = y;
   tmpVec.z = z;
   
   return tmpVec;
}

function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector_tmp(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector_tmp(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}



Or this...
Code:
function camera_follow(ENTITY* ent)
{
   VECTOR* camOffset = {x=-150; y=10; z=50;}
   VECTOR* camAng = {z=ent.pan; y=-10; z=0;}
   
   while(1) 
   {
	vec_set(camera.x,camOffset);  // camera position relative to the player      
	vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
	vec_add(camera.x,ent.x);      // add player position
	vec_set(camera.pan,camAng); // look in player direction, slighty down      
	wait(1);
   }
}



(Also, by the way, does this code make sense? 'VECTOR t = vector(1,2,3); and then VECTOR* r = &t;' I'm wondering if I can use & like that there.)

I guess my biggest concern though is that although I am glad that I haven't seen any more blue screen crashes I am still noticing that the memory usage is growing in my program. It grows more slowly, but every time I move my mouse or press a key the memory usage goes up a little more. (Note, I am also moving entities or rotating bones when these things happen.) It starts out at around 42 meg and increases. The highest I've let it go is to 60 or 70 before terminating it, but I've never seen the memory usage go back down on its own. I guess I can post my entire set of code if that would help. I copied the code for earthball.c to start with as a template and made some tweaks... when I watch its memory usage it starts at 20 something jumps to 32 and then levels out somewhere around 33 megs.

@CoburnDomain... Do you happen to know a link to a page or post with these optimization techniques that I could look over?

Thanks for the help...


[A7 Commercial]
Re: particle effect causes Blue Screen [Re: willjones] #332938
07/13/10 03:27
07/13/10 03:27
Joined: Aug 2008
Posts: 26
Arkansas, USA
W
willjones Offline OP
Newbie
willjones  Offline OP
Newbie
W

Joined: Aug 2008
Posts: 26
Arkansas, USA
Okay, so I've identified the source of my other memory increase problem. (I guess technically it isn't a "memory leak" because that is where unfreed memory is still around after termination... this is ever increasing and unfreed memory during processing.) I was defining the following globals...
Code:
STRING* value ="";

TEXT* tHelp = { 
   pos_x = 10; pos_y = 10;
   font = "Arial#24bi";
   flags = SHADOW;
   string(""); 
}



And then later in the main function I had...
Code:
// ...

   set(tHelp,SHOW);
   STRING* message = ((tHelp->pstring)[0]);
   
   while (1) 
   {
      camera.tilt+=1*key_z;
      camera.tilt-=1*key_x; 

      //...

      //Write info to screen...      
      str_cpy(message,"Tilt = ");
      str_for_num(value,camera.tilt);
      str_cat(message,value);

      //(A bunch of other stuff was being output to the screen like this too
      // with additional str_for_num and str_cat calls '\n' was used as a line
      // breaker when the line got too long.)

      wait(1);
   }



When I took out the str_cpy, str_for_num and str_cat commands the memory problem stopped. So, I'm aware that panels can be used to display text, but I figured this would be fine for a simple little test script. However, for some reason it caused a steady increase in memory resources. I'm still not sure why exactly. Anyway, looks like I at least know my cause. Thanks.


[A7 Commercial]
Re: particle effect causes Blue Screen [Re: willjones] #332963
07/13/10 10:22
07/13/10 10:22
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
"if you do more than 64 calls to vector( ... ) something bad happens? Or is it supposed to just cycle back through and re-use them?"

No, there is no problem with the usage of "vector". I've just tried to say that a "vector" call does not allocate new memory, instead it uses consecutively 64 predefined VECTOR pointers.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1