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

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

Email Script does not reach destination
Hey Guys look at this code snippet :
Code:
//read a line from the file

$myFile = "

Request.UrlReferrer
I need to make it so that a page can only be loaded when a button is clicked on a specific page. I d

how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are tw

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

Cloud Computing?
Hello,

I was wondering if anyone could help explain this term to me. I'm starting to hear it

LinkedList help
Ok so I just learned quickly about lists, so I have a not too hard project I think, but am having a

Keep newlines from textarea?..
I'm creating a simple encoding program, and what I want it to do is retain the newlines, as echoing

grouping within a foreach?
hello all,

I currently have a list of products spit out from my db via a foreach loop. Right

xApp Analytics in BI 7.0
Dear all,

I am trying to implement xApp Analytics in BI 7.0. After I installed the analyt

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