I'm writing a game in C# with SharpDX... So, for drawing a frame, currently i'm using a Timer, with interval set to 1; But this is too slow for a game, so i want something faster... First of all, if I use another thread for the game (and another for the Window itself) and i use a "[while (InGame)]" statement, it is fast, but the GC will never release a single object, and the memory usage just going up and up...
IF I use the SharpDX built in "RenderLoop" function, it is fast also, but the GC still doesn't do anything...
I've tried to override the Window form "WndProc" function, but the game only refresh itself then i'm moving the mouse like a crazy men...
This is my first real game, with a lot of functions, so if any of you have any idea, how would i fix it, or what should I use, I would appreciate it... There must be something in the Window Form lifecycle like a
void FormLife
{
WndProc();
HandleEvents();
etc...
}
(It was just a hard example...)
OR how can i force the GC to do its job, at the end of the while(InGame)
state ?
I've tried GC.Collect();
but its dont work...