Valgrind errors in program using openGL and OOP
I learn OpenGL now, and wrote a simple oop-wrapping for the standard procedures like initializing glfw, creating shaders, loading models etc. I use Ubuntu 16.04 with g++ 5.4.0. When I check my program using valgrind --tool=memchek it shows a lot of errors (30K+) like
"Invalid write/read of size 4" at ...by 0x50CC471: ??? (in
/usr/lib/x86_64-linux-gnu/libglfw.so.3.1)
==14520== by 0x50C9A06: ??? (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x50C4B69: glfwCreateWindow (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x403EC1: Engine::Engine() (in
/home/paul/programming/openGL/main)
This particular error was shown when I used valgrind remotely with gdb, this was the error after reaching the first breakpoint, the Engine class constructor was called there. Even there such errors are happen. Why?
I've read that such errors are possible result of uninitialized variables, but then why there are glfw libs in the stack trace? Do they have such errors?
The code of the Engine class constructor is:
// setEventHandling();
//default values for width and height
window_width = 1280;
window_height = 720;
//default shader filenames
int init_result = glfwInit();
if (!init_result)
{
cout << "Failed to initialize GLFW" << endl;
}
//major required version of the opengl
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
//setting of the profile for which context is created
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(window_width, window_height, "OpenGL", NULL,
NULL);
if (window == NULL)
{
cout << "Failed to create window" << endl;
glfwTerminate();
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if (glewInit() != GLEW_OK)
{
cout << "Failed to initialize GLEW" << endl;
}
glfwGetFramebufferSize(window, &window_width, &window_height);
glViewport(0, 0, window_width, window_height);
glfwSetKeyCallback(this->window,
CallbackInterface::callback_dispatch);
I can't see any uninitialized variables here. So why I see this errors?
By the way, earlier I used SFML to code graphics, and the errors were just the same.
EDIT
Some people in the comments told that the problem is actually because I use OOP, it's bad to use it with OpenGL. Well, I tested the simpliest openGL code which creates only a single window...
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode);
// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;
// The MAIN function, from here we start the application and run the
game loop
int main()
{
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
glfwInit();
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
// Create a GLFWwindow object that we can use for GLFW's functions
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL",
nullptr, nullptr);
if (window == nullptr)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
// Set this to true so GLEW knows to use a modern approach to
retrieving function pointers and extensions
glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Define the viewport dimensions
int width, height;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
// Game loop
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activiated (key pressed, mouse
moved etc.) and call corresponding response functions
glfwPollEvents();
// Render
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap the screen buffers
glfwSwapBuffers(window);
}
// Terminate GLFW, clearing any resources allocated by GLFW.
glfwTerminate();
return 0;
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode)
{
std::cout << key << std::endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
Valgrind output was 26K Errors! Most of them are invalid read/write of size 4/8
==11533== HEAP SUMMARY:
==11533== in use at exit: 114,489 bytes in 669 blocks
==11533== total heap usage: 12,989 allocs, 12,320 frees, 3,704,593
bytes
allocated
==11533==
==11533== LEAK SUMMARY:
==11533== definitely lost: 72 bytes in 1 blocks
==11533== indirectly lost: 0 bytes in 0 blocks
==11533== possibly lost: 0 bytes in 0 blocks
==11533== still reachable: 114,417 bytes in 668 blocks
==11533== suppressed: 0 bytes in 0 blocks
==11533== Rerun with --leak-check=full to see details of leaked memory
==11533==
==11533== For counts of detected and suppressed errors, rerun with: -v
==11533== ERROR SUMMARY: 26274 errors from 478 contexts (suppressed: 0
from 0)
Which makes me to think that there a LOT of bugs in glfw and opengl itself.
c++ opengl valgrind
add a comment |
I learn OpenGL now, and wrote a simple oop-wrapping for the standard procedures like initializing glfw, creating shaders, loading models etc. I use Ubuntu 16.04 with g++ 5.4.0. When I check my program using valgrind --tool=memchek it shows a lot of errors (30K+) like
"Invalid write/read of size 4" at ...by 0x50CC471: ??? (in
/usr/lib/x86_64-linux-gnu/libglfw.so.3.1)
==14520== by 0x50C9A06: ??? (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x50C4B69: glfwCreateWindow (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x403EC1: Engine::Engine() (in
/home/paul/programming/openGL/main)
This particular error was shown when I used valgrind remotely with gdb, this was the error after reaching the first breakpoint, the Engine class constructor was called there. Even there such errors are happen. Why?
I've read that such errors are possible result of uninitialized variables, but then why there are glfw libs in the stack trace? Do they have such errors?
The code of the Engine class constructor is:
// setEventHandling();
//default values for width and height
window_width = 1280;
window_height = 720;
//default shader filenames
int init_result = glfwInit();
if (!init_result)
{
cout << "Failed to initialize GLFW" << endl;
}
//major required version of the opengl
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
//setting of the profile for which context is created
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(window_width, window_height, "OpenGL", NULL,
NULL);
if (window == NULL)
{
cout << "Failed to create window" << endl;
glfwTerminate();
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if (glewInit() != GLEW_OK)
{
cout << "Failed to initialize GLEW" << endl;
}
glfwGetFramebufferSize(window, &window_width, &window_height);
glViewport(0, 0, window_width, window_height);
glfwSetKeyCallback(this->window,
CallbackInterface::callback_dispatch);
I can't see any uninitialized variables here. So why I see this errors?
By the way, earlier I used SFML to code graphics, and the errors were just the same.
EDIT
Some people in the comments told that the problem is actually because I use OOP, it's bad to use it with OpenGL. Well, I tested the simpliest openGL code which creates only a single window...
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode);
// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;
// The MAIN function, from here we start the application and run the
game loop
int main()
{
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
glfwInit();
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
// Create a GLFWwindow object that we can use for GLFW's functions
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL",
nullptr, nullptr);
if (window == nullptr)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
// Set this to true so GLEW knows to use a modern approach to
retrieving function pointers and extensions
glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Define the viewport dimensions
int width, height;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
// Game loop
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activiated (key pressed, mouse
moved etc.) and call corresponding response functions
glfwPollEvents();
// Render
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap the screen buffers
glfwSwapBuffers(window);
}
// Terminate GLFW, clearing any resources allocated by GLFW.
glfwTerminate();
return 0;
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode)
{
std::cout << key << std::endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
Valgrind output was 26K Errors! Most of them are invalid read/write of size 4/8
==11533== HEAP SUMMARY:
==11533== in use at exit: 114,489 bytes in 669 blocks
==11533== total heap usage: 12,989 allocs, 12,320 frees, 3,704,593
bytes
allocated
==11533==
==11533== LEAK SUMMARY:
==11533== definitely lost: 72 bytes in 1 blocks
==11533== indirectly lost: 0 bytes in 0 blocks
==11533== possibly lost: 0 bytes in 0 blocks
==11533== still reachable: 114,417 bytes in 668 blocks
==11533== suppressed: 0 bytes in 0 blocks
==11533== Rerun with --leak-check=full to see details of leaked memory
==11533==
==11533== For counts of detected and suppressed errors, rerun with: -v
==11533== ERROR SUMMARY: 26274 errors from 478 contexts (suppressed: 0
from 0)
Which makes me to think that there a LOT of bugs in glfw and opengl itself.
c++ opengl valgrind
Comments are not for extended discussion; this conversation has been moved to chat.
– Samuel Liew♦
Nov 25 '18 at 3:52
add a comment |
I learn OpenGL now, and wrote a simple oop-wrapping for the standard procedures like initializing glfw, creating shaders, loading models etc. I use Ubuntu 16.04 with g++ 5.4.0. When I check my program using valgrind --tool=memchek it shows a lot of errors (30K+) like
"Invalid write/read of size 4" at ...by 0x50CC471: ??? (in
/usr/lib/x86_64-linux-gnu/libglfw.so.3.1)
==14520== by 0x50C9A06: ??? (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x50C4B69: glfwCreateWindow (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x403EC1: Engine::Engine() (in
/home/paul/programming/openGL/main)
This particular error was shown when I used valgrind remotely with gdb, this was the error after reaching the first breakpoint, the Engine class constructor was called there. Even there such errors are happen. Why?
I've read that such errors are possible result of uninitialized variables, but then why there are glfw libs in the stack trace? Do they have such errors?
The code of the Engine class constructor is:
// setEventHandling();
//default values for width and height
window_width = 1280;
window_height = 720;
//default shader filenames
int init_result = glfwInit();
if (!init_result)
{
cout << "Failed to initialize GLFW" << endl;
}
//major required version of the opengl
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
//setting of the profile for which context is created
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(window_width, window_height, "OpenGL", NULL,
NULL);
if (window == NULL)
{
cout << "Failed to create window" << endl;
glfwTerminate();
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if (glewInit() != GLEW_OK)
{
cout << "Failed to initialize GLEW" << endl;
}
glfwGetFramebufferSize(window, &window_width, &window_height);
glViewport(0, 0, window_width, window_height);
glfwSetKeyCallback(this->window,
CallbackInterface::callback_dispatch);
I can't see any uninitialized variables here. So why I see this errors?
By the way, earlier I used SFML to code graphics, and the errors were just the same.
EDIT
Some people in the comments told that the problem is actually because I use OOP, it's bad to use it with OpenGL. Well, I tested the simpliest openGL code which creates only a single window...
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode);
// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;
// The MAIN function, from here we start the application and run the
game loop
int main()
{
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
glfwInit();
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
// Create a GLFWwindow object that we can use for GLFW's functions
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL",
nullptr, nullptr);
if (window == nullptr)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
// Set this to true so GLEW knows to use a modern approach to
retrieving function pointers and extensions
glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Define the viewport dimensions
int width, height;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
// Game loop
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activiated (key pressed, mouse
moved etc.) and call corresponding response functions
glfwPollEvents();
// Render
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap the screen buffers
glfwSwapBuffers(window);
}
// Terminate GLFW, clearing any resources allocated by GLFW.
glfwTerminate();
return 0;
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode)
{
std::cout << key << std::endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
Valgrind output was 26K Errors! Most of them are invalid read/write of size 4/8
==11533== HEAP SUMMARY:
==11533== in use at exit: 114,489 bytes in 669 blocks
==11533== total heap usage: 12,989 allocs, 12,320 frees, 3,704,593
bytes
allocated
==11533==
==11533== LEAK SUMMARY:
==11533== definitely lost: 72 bytes in 1 blocks
==11533== indirectly lost: 0 bytes in 0 blocks
==11533== possibly lost: 0 bytes in 0 blocks
==11533== still reachable: 114,417 bytes in 668 blocks
==11533== suppressed: 0 bytes in 0 blocks
==11533== Rerun with --leak-check=full to see details of leaked memory
==11533==
==11533== For counts of detected and suppressed errors, rerun with: -v
==11533== ERROR SUMMARY: 26274 errors from 478 contexts (suppressed: 0
from 0)
Which makes me to think that there a LOT of bugs in glfw and opengl itself.
c++ opengl valgrind
I learn OpenGL now, and wrote a simple oop-wrapping for the standard procedures like initializing glfw, creating shaders, loading models etc. I use Ubuntu 16.04 with g++ 5.4.0. When I check my program using valgrind --tool=memchek it shows a lot of errors (30K+) like
"Invalid write/read of size 4" at ...by 0x50CC471: ??? (in
/usr/lib/x86_64-linux-gnu/libglfw.so.3.1)
==14520== by 0x50C9A06: ??? (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x50C4B69: glfwCreateWindow (in /usr/lib/x86_64-linux-
gnu/libglfw.so.3.1)
==14520== by 0x403EC1: Engine::Engine() (in
/home/paul/programming/openGL/main)
This particular error was shown when I used valgrind remotely with gdb, this was the error after reaching the first breakpoint, the Engine class constructor was called there. Even there such errors are happen. Why?
I've read that such errors are possible result of uninitialized variables, but then why there are glfw libs in the stack trace? Do they have such errors?
The code of the Engine class constructor is:
// setEventHandling();
//default values for width and height
window_width = 1280;
window_height = 720;
//default shader filenames
int init_result = glfwInit();
if (!init_result)
{
cout << "Failed to initialize GLFW" << endl;
}
//major required version of the opengl
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
//setting of the profile for which context is created
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(window_width, window_height, "OpenGL", NULL,
NULL);
if (window == NULL)
{
cout << "Failed to create window" << endl;
glfwTerminate();
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if (glewInit() != GLEW_OK)
{
cout << "Failed to initialize GLEW" << endl;
}
glfwGetFramebufferSize(window, &window_width, &window_height);
glViewport(0, 0, window_width, window_height);
glfwSetKeyCallback(this->window,
CallbackInterface::callback_dispatch);
I can't see any uninitialized variables here. So why I see this errors?
By the way, earlier I used SFML to code graphics, and the errors were just the same.
EDIT
Some people in the comments told that the problem is actually because I use OOP, it's bad to use it with OpenGL. Well, I tested the simpliest openGL code which creates only a single window...
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode);
// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;
// The MAIN function, from here we start the application and run the
game loop
int main()
{
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
glfwInit();
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
// Create a GLFWwindow object that we can use for GLFW's functions
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL",
nullptr, nullptr);
if (window == nullptr)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
// Set this to true so GLEW knows to use a modern approach to
retrieving function pointers and extensions
glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Define the viewport dimensions
int width, height;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
// Game loop
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activiated (key pressed, mouse
moved etc.) and call corresponding response functions
glfwPollEvents();
// Render
// Clear the colorbuffer
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap the screen buffers
glfwSwapBuffers(window);
}
// Terminate GLFW, clearing any resources allocated by GLFW.
glfwTerminate();
return 0;
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int
action, int mode)
{
std::cout << key << std::endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
Valgrind output was 26K Errors! Most of them are invalid read/write of size 4/8
==11533== HEAP SUMMARY:
==11533== in use at exit: 114,489 bytes in 669 blocks
==11533== total heap usage: 12,989 allocs, 12,320 frees, 3,704,593
bytes
allocated
==11533==
==11533== LEAK SUMMARY:
==11533== definitely lost: 72 bytes in 1 blocks
==11533== indirectly lost: 0 bytes in 0 blocks
==11533== possibly lost: 0 bytes in 0 blocks
==11533== still reachable: 114,417 bytes in 668 blocks
==11533== suppressed: 0 bytes in 0 blocks
==11533== Rerun with --leak-check=full to see details of leaked memory
==11533==
==11533== For counts of detected and suppressed errors, rerun with: -v
==11533== ERROR SUMMARY: 26274 errors from 478 contexts (suppressed: 0
from 0)
Which makes me to think that there a LOT of bugs in glfw and opengl itself.
c++ opengl valgrind
c++ opengl valgrind
edited Nov 23 '18 at 20:12
Pavlo Kovalov
asked Nov 22 '18 at 18:33
Pavlo KovalovPavlo Kovalov
158
158
Comments are not for extended discussion; this conversation has been moved to chat.
– Samuel Liew♦
Nov 25 '18 at 3:52
add a comment |
Comments are not for extended discussion; this conversation has been moved to chat.
– Samuel Liew♦
Nov 25 '18 at 3:52
Comments are not for extended discussion; this conversation has been moved to chat.
– Samuel Liew♦
Nov 25 '18 at 3:52
Comments are not for extended discussion; this conversation has been moved to chat.
– Samuel Liew♦
Nov 25 '18 at 3:52
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436521%2fvalgrind-errors-in-program-using-opengl-and-oop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436521%2fvalgrind-errors-in-program-using-opengl-and-oop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Comments are not for extended discussion; this conversation has been moved to chat.
– Samuel Liew♦
Nov 25 '18 at 3:52