Jump to content

  • Log In with Google      Sign In   
  • Create Account


DoctorGlow

Member Since 17 Jan 2010
Offline Last Active Today, 11:15 AM

#5172310 Visual Programming

Posted by DoctorGlow on 08 August 2014 - 10:20 AM

I think true tests for this would be to "eat your own dog food". IOW, try to make a game with this and see how well it works out, and I mean something more complicated, rather then simple pong or Tic-Tac-Toe. This should give you good insight into your project/library, how well it works, how much changes, custom code you had to do, etc. Once you finish, you can try another different game and then you end up with cool and useful samples code for your perspective customers.




#5172124 Debugging a system hang (entire OS freezes)

Posted by DoctorGlow on 07 August 2014 - 02:57 PM

I would try to log as much as I could to a file (flush it out or close the file after each write). Then when it hangs, reboot, and look over the log file. This may give you at least approximate area where it hags.




#5157097 Creating a code editor/IDE

Posted by DoctorGlow on 30 May 2014 - 10:48 PM

Did you find this: http://www.scintilla.org/ScintillaDoc.html#Autocompletion




#5156502 Why is Array highlighted in blue (Visual Studio 2007)

Posted by DoctorGlow on 28 May 2014 - 10:10 AM

It does not exist, maybe you meant 2005 or 2008 (http://en.wikipedia.org/wiki/Microsoft_Visual_Studio). And it's 2014 dry.png




#5137907 Need help embedding python script in c++

Posted by DoctorGlow on 10 March 2014 - 02:21 PM

Probably not a help with your current problem, but I have used boost python on several occasions embedding in different professional engines and always had good experience. Of course YMMV.




#5106046 cache friendly lock free concept?

Posted by DoctorGlow on 31 October 2013 - 02:22 PM

I mark lockstate as violatile, which ensures it is usable for memory locking in this example.

 

This is wrong assumption. From many links about, I picked one, http://en.wikipedia.org/wiki/Volatile_variable

 

Quote:

Operations on volatile variables are not atomic, nor do they establish a proper happens-before relationship for threading. This is according to the relevant standards (C, C++, POSIX, WIN32),[2] and this is the matter of fact for the vast majority of current implementations. Thus, the usage of volatile keyword as a portable synchronization mechanism is discouraged by many C/C++ groups.[3][4][5]




#4972305 Using New and Delete in inherited classes and stored pointers to the new object

Posted by DoctorGlow on 22 August 2012 - 12:38 PM

[source lang="cpp"]Entity::EntityList[i]->OnCleanup();if(Entity::EntityList[i]->Type == ENTITY_TYPE_BULLET_PLAYER){ delete Entity::EntityList[i];}[/source]

Just to clarify here.
when you call OnCleanup() method, you said that you are doing this in it: delete this. This will delete that instance of an object which in your case is object at Entity::EntityList[i], but after that you are trying to access member variable with this line:
[source lang="cpp"]Entity::EntityList[i]->Type[/source]
and then you end-up deleting that object
[source lang="cpp"]delete Entity::EntityList[i];[/source]
which was already deleted by using delete this, hence you will get undefined behavior here.

If you goggle delete this you will find allot of resources and explanations. Here is a first one to get you started: http://www.parashift...elete-this.html


#4972207 Using New and Delete in inherited classes and stored pointers to the new object

Posted by DoctorGlow on 22 August 2012 - 08:30 AM

If I understand correctly, the Entity was deleted by using delete this inside OnCleanup() method, but have you removed that pointer from the list Entity::EntityList? If you did not, then you have what is called dangling pointer. It underscores what SiCrane was saying about using smart pointer to manage memory and life time of objects.

http://en.wikipedia....angling_pointer


#4970662 Embedded Help!

Posted by DoctorGlow on 17 August 2012 - 02:30 PM

And yes it is the board's fault, I suggest before being condescending you just help out and not assume. Thank you.


Then why code snippet from ReaperSMS has spaces and it looks readable?


#4956004 C++ not initilizing

Posted by DoctorGlow on 05 July 2012 - 09:20 AM

Look up http://en.wikipedia....ard_declaration (Forward declaration)


#4954037 ELuna(a new project to bind C/C++ and Lua)

Posted by DoctorGlow on 29 June 2012 - 01:01 PM

How does your library differ from luabind?


#4922395 [SDL.Net] Crazy memory leak

Posted by DoctorGlow on 15 March 2012 - 02:58 PM


Hey guys, I have a program with a crazy memory leak (leaking ~20mb/s).
I've found the problem, but I can't seem to find a working alternative.

Basically, I have some code which runs on every third tick:

void Draw()
{
  scenebmp.render(bmp, false); //render the current scene to a bitmap image
  sceneSurface = new Surface(bmp); //create a new surface from updated bitmap image
  window.BlitToScreen(sceneSurface); //send the new surface to the 'window' class to be blitted to the screen
}

'sceneSurface = new Surface(bmp);' is the line which is causing the leak. I have tried putting
sceneSurface.Dispose();
at the end of the code block, but it doesn't seem to have any effect.

What would be the best way to fix this?
Is there a way to update the Surface from a bitmap without creating a new Surface?

Thanks for any assistance.

EDIT: http://pastebin.com/3We9UdVz is the file which contains the problem
EDIT2: Solved by taking a different approach to rendering.


If you new, you must delete

did you try deleting the old scene before you created a new one? ie:
void Draw()
{
  scenebmp.render(bmp, false); //render the current scene to a bitmap image
  if (sceneSurface) {
	delete sceneSurface;
  }
  sceneSurface = new Surface(bmp); //create a new surface from updated bitmap image
  window.BlitToScreen(sceneSurface); //send the new surface to the 'window' class to be blitted to the screen
}


His code is C# not C++


#4884428 C++ friend

Posted by DoctorGlow on 15 November 2011 - 10:10 PM

Maybe of relevance Friends.


#4882691 C++: memory deallocation

Posted by DoctorGlow on 10 November 2011 - 12:59 PM


That said, Task Manager isn't a good way to measure memory usage. In somewhat oversimplified terms, it tells you how much memory the operating system has given to your program, not how much memory your program is actually using.


Oh, I see. Then probably is better to use some other tools to check memory usage. I'm on OSX, but I need to debug my application also in WIndows. What do you actually use (if any) to check memory footprint?


Process Explorer is a good start.


#4852524 [DX9, C++] shared_ptr and IDirect3DTexture9 (or any other COM interface)

Posted by DoctorGlow on 22 August 2011 - 03:43 PM

There are smart pointers for COM already provided (it may work for you):
http://legalizeadult...smart-pointers/




PARTNERS