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

Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time

how can we add data from dynamic fields to mysql db in php
i have a script which i found on the internet. i modify that script according to my needs. what is i

mr8m - reverse document
Friends,

I'm trying to reverse a document held by MIRO, but it reports the message balan

Is it possible to stop reservation creation in PM Order?
Hi All,

Is it possible to stop reservation creation in PM Order?

Thanks in adv

Sequre login with cookies.
I want to build secure login with cookies. I just want your ideas about this, your suggestions. What

Alternate messaging
I have 4 strings in MySQL db1

$string1 : Hello
$string2 : Hi
$string3 : Great
$strin

Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont re

Regarding accessing SQL query issued by any user in Oracle 10g
Hi all,
i want to know the queries issued by various users accessing a database...

Check Digits and extracting digits
I think I can figure out the code for this but I am having a very hard time getting past the first s

PHP search multiple input field box help
I am having a problem with my search script. At current it will simply search by a selected date whi

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