answersLogoWhite

0


Best Answer

No. Calling new returns a pointer to allocated memory. If you re-use a pointer to store the return value, then you must release the memory that it previously pointed at, either by deleting the pointer, or by maintaining a separate pointer to the original memory. Calling new will not release the current memory for you.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When you call new will it internally call delete in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What will happen if you allocate memory using new and free it using free or allocate sing calloc and free it using delete?

The C++ new uses malloc internally to allocate memory and the C++ delete uses free internally to revoke memory. However, they are not interchangeable and so memory allocated with new MUST be revoked with delete. If you mix them up, you will have a memory leak! Haya.


Add two numbers in pointer in using c plus plus?

int* a = new int(40); int* b = new int(2); int x = *a + *b; // x = 42 delete b; delete a;


What are new and delete operators in c plus plus?

New and Delete are the memory management operators in c++,like c language we use malloc() and calloc() functions to allocate memory and free() functiong to release the memory similarily we use new to allocate memory in C++ and Delete to release the allocated memory....


Are new and delete operators in c plus plus related to flush?

The new and delete operators in C++ are not related to flush. New is used to allocate memory, while delete is used to deallocate memory. Flush is a library concept that allows you to ensure that IO is completed, and not buffered, before proceeding to the next step.


Program for new and delete operator using c plus plus?

#include<iostream> struct object { int m_data; }; void main() { object obj=new object; obj.m_data = 42; delete( obj ); return( 0 ); }


Why use new and delete operator overloading in c plus plus?

one reason to use new and delete operator overloading in c++ is when you are using your own memory manager code. when the user of your code calls the new keywork, your memory manager code can allocate memory.


Write c plus plus program for new and delete operator using class?

#include<iostream> class foo{ int m_data; }; int main() { foo* p=new foo; delete( foo), foo=NULL; return(0); }


Difference between new and delete in c plus plus?

New creates objects. Delete deletes objects. eg - int *x = new int; // Give me a new int eg - delete x; // Delete the int that was created These functions are useful because they allow you to allocate as much memory as you need (eg ask the user for how many numbers do they want to type in, allocate that many ints and then loop through and store the values). Note that there are two other operators, new[] and delete[] that are used for creating/deleting arrays. eg - int *x = new int[5]; // Give me 5 new ints eg - delete[] x; // Delete the 5 ints If you mix and match the different operators(eg new[] with delete) you may end up with memory leaks - delete only expects one object, so if you give it 10 objects created by new[] then it will only delete one.


How do you delete your call of duty screen name?

You can not delete an online profile, your have to start again with a new user. If you want to delete your campaign, you could (on ps3) click home button, go onto game menu, scoll up until you see memory card and delete the call of duty data. WARNING: BACK UP CALL OF DUTY DATA BEFORE DELETING (incase you want back)


How do you delete variables that are dynamically allocated?

It depends, especially if you are going to use C++.If you allocated the variable using the malloc call or any of its derivatives you must use the corresponding 'free' subroutine call to delete them.If you use the more modern C++ 'new' operator, then use the 'delete' operator to remove the memory dynamically in the program.


How do you fix broking tolet on sim 2?

You can ether call the repair man, fix it yourself or delete it and buy a new one.


How do you delete a profile from Call of Duty Black Ops?

you don't. it's linked to your hard drive on your Xbox so to get a new profile you have to make a new account on live.