Click here to Skip to main content
15,886,638 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: very urgent help needed in openmp Pin
loyal ginger16-Apr-10 7:54
loyal ginger16-Apr-10 7:54 
GeneralRe: very urgent help needed in openmp Pin
aruneshjoshi16-Apr-10 8:06
aruneshjoshi16-Apr-10 8:06 
QuestionRe: very urgent help needed in openmp Pin
David Crow16-Apr-10 8:29
David Crow16-Apr-10 8:29 
AnswerRe: very urgent help needed in openmp Pin
aruneshjoshi16-Apr-10 8:44
aruneshjoshi16-Apr-10 8:44 
GeneralRe: very urgent help needed in openmp Pin
rchrd16-Apr-10 9:26
rchrd16-Apr-10 9:26 
QuestionAllocation/Deallocation from Memory Pool [Solved] Pin
Skippums16-Apr-10 4:17
Skippums16-Apr-10 4:17 
AnswerRe: Allocation/Deallocation from Memory Pool Pin
«_Superman_»16-Apr-10 6:41
professional«_Superman_»16-Apr-10 6:41 
AnswerRe: Allocation/Deallocation from Memory Pool [Solved] Pin
cmk16-Apr-10 9:06
cmk16-Apr-10 9:06 
For yor case it works.

As a general rule it won't.

delete[] against an object, whose type has a destructor will call the 'vector deleting destructor', which will call the destructor for each element.

The problem is the number of elements.

When new[] is called on a type with a destructor:
1. malloc a block large enough to hold the reqested # of elements, the actual block size will be rounded up to some grain size.
2. store the actual block size (bytes) with the block for free().
3. store the requested # of elements with the block so delete[] can iterate over them and call ~().

When you call delete on a different (sized) type the # of elements stored with the block will be wrong and you will either call ~() on too few or too many elements.

If too few then you could have a memory leak if the destructor frees resources.

If too many then you corrupt the heap.
...cmk

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack

AnswerRe: Allocation/Deallocation from Memory Pool [Solved] Pin
Gwenio16-Apr-10 9:21
Gwenio16-Apr-10 9:21 
QuestionCan we Insert table into SDI Application ? Pin
Khathar16-Apr-10 1:54
Khathar16-Apr-10 1:54 
AnswerRe: Can we Insert table into SDI Application ? Pin
Maximilien16-Apr-10 2:50
Maximilien16-Apr-10 2:50 
AnswerRe: Can we Insert table into SDI Application ? Pin
«_Superman_»16-Apr-10 6:47
professional«_Superman_»16-Apr-10 6:47 
QuestionCComboBox the max text length ?? Pin
Arrin16-Apr-10 0:28
Arrin16-Apr-10 0:28 
AnswerRe: CComboBox the max text length ?? SOLVED Pin
Arrin16-Apr-10 0:43
Arrin16-Apr-10 0:43 
QuestionWorker Thread GUI Pin
MsmVc15-Apr-10 22:21
MsmVc15-Apr-10 22:21 
AnswerRe: Worker Thread GUI Pin
Cedric Moonen15-Apr-10 22:33
Cedric Moonen15-Apr-10 22:33 
AnswerRe: Worker Thread GUI Pin
Eugen Podsypalnikov15-Apr-10 22:44
Eugen Podsypalnikov15-Apr-10 22:44 
GeneralRe: Worker Thread GUI Pin
MsmVc15-Apr-10 23:07
MsmVc15-Apr-10 23:07 
GeneralRe: Worker Thread GUI Pin
Cedric Moonen15-Apr-10 23:17
Cedric Moonen15-Apr-10 23:17 
GeneralRe: Worker Thread GUI [modified] Pin
Eugen Podsypalnikov15-Apr-10 23:38
Eugen Podsypalnikov15-Apr-10 23:38 
GeneralRe: Worker Thread GUI Pin
Eugen Podsypalnikov16-Apr-10 0:21
Eugen Podsypalnikov16-Apr-10 0:21 
GeneralRe: Worker Thread GUI Pin
Cedric Moonen15-Apr-10 23:13
Cedric Moonen15-Apr-10 23:13 
GeneralRe: Worker Thread GUI Pin
Eugen Podsypalnikov16-Apr-10 0:20
Eugen Podsypalnikov16-Apr-10 0:20 
GeneralRe: Worker Thread GUI Pin
Cedric Moonen16-Apr-10 1:01
Cedric Moonen16-Apr-10 1:01 
GeneralRe: Worker Thread GUI Pin
Eugen Podsypalnikov16-Apr-10 1:27
Eugen Podsypalnikov16-Apr-10 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.