Category : heap-corruption

i am trying to make my own Vector and after i changed the move constructor i get Heap corruption detected: after normal block (#34115). This is the move constructor: template<typename T> inline Vector<T>::Vector(Vector&& other) : m_nrOfElements(std::exchange(other.m_nrOfElements, 0)), m_capacity(std::exchange(other.m_capacity, 0)), m_elements(std::exchange(other.m_elements, nullptr)) { } This is the code in its total: #pragma once #include <iostream> template ..

Read more

I’m getting a heap corruption error whenever the following method is called: bool TextureData::loadFromMemory(char* memData, int w, int h) { GLuint texId; glEnable(GL_TEXTURE_2D); glGenTextures(1, &texId); glTextureId = static_cast<int>(texId); glBindTexture(GL_TEXTURE_2D, texId); // Bind the texture glPixelStorei (GL_UNPACK_ALIGNMENT, 1); memWidth = width = w; memHeight = height = h; int newPad = 0;//(4 – (w*4)%4)==4 ? 0 ..

Read more

My application throws an exception most probably due to heap corruption as the error code given is c0000374. It does this when creating the object at line : Library library2("2"); My code: #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <fstream> using namespace std; class Book { private: char author[50]; char bookid[10]; char title[80]; public: Book(char* ..

Read more

I’m trying to test the Windows API HeapSetInformation with the value HeapEnableTerminationOnCorruption by attempting to create an Exception code 0xC0000374 which means STATUS_HEAP_CORRUPTION. Is there some easy C code to intentionally corrupt the heap? I’ve tried the following but does not crash or generate any exception? #include <windows.h> #include <stdio.h> int main(void) { BOOL bResult ..

Read more