Jump to content
  • Advertisement

bzroom

Member
  • Content count

    2555
  • Joined

  • Last visited

Community Reputation

647 Good

About bzroom

  • Rank
    Contributor

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. bzroom

    Smart Pointers Aren't Always So Smart

    This has become a rant about shared_ptr, not smart ptrs in general? We use intrusive ref counting to eliminate the extra heap allocations. Our pointer wrapper can be defined to be either thread safe or not (by default it is not). I agree that smart pointers can cause performance issues, mostly with cache misses since you have to fetch the object (or ref counter location) just to copy the pointer address. It would indeed be wise to use raw pointers for low level systems such as rendering. The render manager may store a single smart pointer as objects are registered. This will preserve the object while it is inside the renderer. Then, internally raw pointers can be "safely" used. Smart pointers also often cause circular references and memory leaks. But imo, their benefits FAR outweigh their pitfalls.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!