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

Author Topic: sfml growing memory usage  (Read 1399 times)

0 Members and 1 Guest are viewing this topic.

Martinezzz

  • Newbie
  • *
  • Posts: 6
    • View Profile
sfml growing memory usage
« on: September 19, 2014, 03:53:33 pm »
i realize my sfml constantly growing memory usage even for simple rectangle drawing
aprox 1000k /sec
and wery soon get in task menegers top list off all apps runing on my pc

import sfml as sf

# create the main window
window = sf.RenderWindow(sf.VideoMode(640, 480), "pySFML Window")





def square(pos, angle,size):
    sq=sf.graphics.RectangleShape()
   
    sx=size.x
    sy=size.y
    sq.size=sf.Vector2(sx, sy)
    sq.fill_color=sf.Color.RED    

    sq.rotation=angle
    sq.position=pos
    window.draw(sq)
    sq=0
   
# start the game loop
while window.is_open:
    # process events
    for event in window.events:
        # close window: exit
        if type(event) is sf.CloseEvent:
            window.close()

    window.clear() # clear screen
   
    square(sf.Vector2(10, 10),0,sf.Vector2(10, 10))

    window.display() # update the window

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sfml growing memory usage
« Reply #1 on: September 19, 2014, 04:17:13 pm »
Try the same example in C++ (or a precompiled one from the SDK) and see if it happens too.
Laurent Gomila - SFML developer

Martinezzz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: sfml growing memory usage
« Reply #2 on: September 20, 2014, 08:37:04 am »
ha ha i find solution


sq=sf.graphics.RectangleShape()  <--- if this hapens every frame memory grows
def square(pos, angle,size):
    global sq
   
    sx=size.x
    sy=size.y
    sq.size=sf.Vector2(sx, sy)
    sq.fill_color=sf.Color.RED    

    sq.rotation=angle
    sq.position=pos
    window.draw(sq)

Martinezzz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: sfml growing memory usage
« Reply #3 on: September 20, 2014, 10:12:40 am »
problem still exsist with


def text(msg,pos,c,s):
   
    create a text
    text = sf.Text(msg)

i print lot of text on screen and this causes memory grow rapidly

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sfml growing memory usage
« Reply #4 on: September 20, 2014, 10:19:08 am »
Until you try some C++ code, we won't be able to help you. If you can't test C++, then please post on the Python forum and hope that the author of the binding answers ;)
Laurent Gomila - SFML developer