Dynamic memory problem


Posted on 16th Feb 2014 07:03 pm by admin

Hey,

At the beginning of my code, I have this line:

Shape* gShape = 0;

As this is dynamic memory, I delete it at the end:
delete gShape;
gShape = 0;

This compiles fine and runs fine, but as soon as I close the program, I get a "not working anymore" window from the OS (you know which I mean; "send this to microsoft bleeeeh"). It only crashes this way when I actually use the Shape instance, so when I use gShape = new class(parameters);. If I don't use the instance (I keep it 0), it doesn't crash.

What am I doing wrong?

Thank you!

No comments posted yet

Your Answer:

Login to answer
329 Like 31 Dislike
Previous forums Next forums
Other forums

Material xxx does not exist in plant xxx
Dear All,

I am working for a steel project which is repetitive manufacturing.

Issues: PHP Forms -Clearing
I've tried looking online before actually asking for help, but I've been looking for about the past

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

selection tool on raster image
Hi!
I have to implement in my app a selection tool which lets users to select region of any shape

Preventing blank or already entered values
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLAN

Creating Images from images in PHP
Okay well I am trying to make a 'dynamic' calender image with PHP.

I have images like this:

Beginners syntax and loop questions - help please!
Hi everyone,

I have some problems with php code. I'm currently in the middle of learning php,

DateObject and Nulls
Hi all,

I have an array mapped to a value object. One of the items in the array is a PHP Date

Registration
ok so i have a site where people can register and login which works now thanks to someone on here th

how to hide input fields on selection screen using variant attribute
Hello all,

I want to know how to hide input fields on selection screen using variant attr

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash