Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Avoid allocations at global startup?  (Read 2767 times)

0 Members and 1 Guest are viewing this topic.

xelanoimis

  • Newbie
  • *
  • Posts: 3
    • View Profile
Avoid allocations at global startup?
« on: November 01, 2010, 11:26:58 pm »
Hi there,

First of all, good job with the library! The design looks great!

I was wondering if you could avoid having memory allocations at "global startup" - before the main function is executed.

I'm talking about the
sf::Context& Dummy = sf::Context::GetGlobal();
in context.cpp

It shows as leaks on my memory leaks report - it reports before exiting the main function. I suppose the memory is set free when the destructor is called, but I prefer to be aware of the order in which objects are allocated. It's good practice, especially with memory allocators or allocations debug tracking.

Maybe a simple global function like InitSFML would be ok, even with the fully C++ design.

--------

Another suggestion is to add project configurations with runtime library linked as Multi-Thread/Multi-Thread Debug, not only Multi-Thread DLL/Multi-Thread Debug DLL. And add these as precompiled libs too.

Now, if the sfml dll is used within a project with such settings, it crushes - for me it does when the window pointer is deleted and the window title is messed up. Probably other things as well.

Thanks!
Alex

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Avoid allocations at global startup?
« Reply #1 on: November 01, 2010, 11:36:18 pm »
These issues are not problems anymore in SFML 2.
Laurent Gomila - SFML developer

xelanoimis

  • Newbie
  • *
  • Posts: 3
    • View Profile
Avoid allocations at global startup?
« Reply #2 on: November 03, 2010, 10:48:45 pm »
That's great! Thanks!
I'll look into it.

 

anything