sfml 2.4.1内存泄漏

时间:2017-01-29 20:49:45

标签: c++ visual-studio-2015 sfml

我使用SFML-2.4.1,MSVS2015,我有最后一张NVIDIA卡(378.49),这个程序有内存泄漏(在> 5分钟内工作时会很明显):

.code32
.text


.globl _start
_start:

;  .globl main
  .extern printf

  pushl %ebp
  movl %esp, %ebp
;  subl $4, %esp

  movl 4(%ebp), %eax 
;  movl 12(%ebp), %ebx
 ; movl $0, %ecx

  cmp $2, %eax
  jne argCount  

  pushl %eax
  pushl $msg2
  call printf
  add $8, %esp

  movl %ebp, %esp
  popl %ebp

;  movl $1, %eax
 ; movl $0, %ebx
 ; int $0x80
  call exit

argCount:
  pushl %ebp
  movl %esp, %ebp

  pushl $msg3
  call printf
  add $4, %esp

  movl %ebp, %esp
  popl %ebp

  ret


.data

;  .asciz "Arg = %s"
  msg2: .asciz "Arg Count = %d\n"
  msg3: .asciz "This program takes 1 argument -> sizeOfArray\n"

这段代码没有它:

#include <SFML\Graphics.hpp>

using namespace sf;

int main()
{
    Image image;
    image.create(200, 200);
    while (1)
    {
        Texture t;
        t.loadFromImage(image);
    }
    system("pause");
    return 0;
}

这是#include <SFML\Graphics.hpp> using namespace sf; int main() { Image image; image.create(200, 200); Texture t; while (1) { t.loadFromImage(image); } system("pause"); return 0; } 中的问题吗?

1 个答案:

答案 0 :(得分:0)

我无法真正重现这个问题,我也不会发现这种情况会发生。也许它有一些驱动程序错误和/或可能与你的显卡型号结合设置?

将MSVC 2017 RC的代码段编译为x64,无论运行多长时间(GTX 1080上的驱动程序版本相同),程序在24 MB内存使用率方面都非常稳定。

尝试编译最新的源代码版本,看看是否会发生任何变化。