Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17063

Huge memory leaks when I load textures

$
0
0

Hi !

I have memory leaks in this code, but I don't know how I could fix them. 

Can you help me ?

DWORD WINAPI D3D11Rendering::texturesLoading(LPVOID lpParam)

{



LoadingThreadsParameters* parameters = (LoadingThreadsParameters*)lpParam;



for (unsigned short i = parameters->beginning; i <= parameters->end; i++)

{

 string textureName(objectsData[i].textureName);



 //_ASSERT(i != 236);



 if (textureName.length() > 1)

 {

   



  string textureDirectory("./Assets/Textures/");



  textureName.replace(textureName.length() - 4, 4, ".jpg");



  string textureFilePath = textureDirectory + textureName;



  // Load the texture and initialize an ID3D11Texture2D object.

  HRESULT result = D3DX11CreateTextureFromFile(deviceDX11, textureFilePath.c_str(), NULL, NULL, (ID3D11Resource **)&amp;textureData[i], NULL);

   



  D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc;



  // Fill in the D3D11_SHADER_RESOURCE_VIEW_DESC structure.

  shaderResourceViewDesc.Format …

Viewing all articles
Browse latest Browse all 17063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>