Skip to main content
gamedev.net
🔒 Locked

Dynamic Memory Questions

Started by DarkNebula Jan 10, 2004 at 7:46 PM 2 replies 350+ views
Original Post
DarkNebula
DarkNebula
Is there any thing bad about using dynamic memory a lot? I use it for all my classes: Like, CDIKeyboard *diKeyboard = new CDIKeyboard(); Is this a bad thing? A good thing? Or it doesn''t really matter? - DarkNebula
DarkNebula
DarkNebula
Thanks for your reply, if anyone would like to add anything else feel free to.

- DarkNebula
Quirk
Quirk
dynamic allocation is slower than static allocation. So if you frequently create objects you might want to preallocate a bunch of those and use some kind of Get method for retrieval.

For the keyboard example it would be quite appropriate using the new operator since it''s not something one would do multiple times every frame.

/Q

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.