Click here to Skip to main content
16,004,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: the momory leak Pin
John R. Shaw25-Oct-05 9:29
John R. Shaw25-Oct-05 9:29 
Generalhere is the steps Pin
valerie9925-Oct-05 10:21
valerie9925-Oct-05 10:21 
AnswerRe: the momory leak Pin
David Crow25-Oct-05 9:32
David Crow25-Oct-05 9:32 
Generalthe more leaks...... Pin
valerie9925-Oct-05 10:03
valerie9925-Oct-05 10:03 
GeneralRe: the more leaks...... Pin
John R. Shaw25-Oct-05 10:29
John R. Shaw25-Oct-05 10:29 
GeneralRe: the more leaks...... Pin
valerie9925-Oct-05 10:51
valerie9925-Oct-05 10:51 
QuestionRe: the more leaks...... Pin
David Crow26-Oct-05 3:25
David Crow26-Oct-05 3:25 
GeneralRe: the more leaks...... Pin
krmed26-Oct-05 5:12
krmed26-Oct-05 5:12 
According to what you said:

valerie99 wrote:
because the "NumberofGroups = this->GetContributoryAmounts (mainPos); " will call the "Groups = new GROUPSTRUCT[NumberofGroups];


so, if this is true, when you do this:

valerie99 wrote:
NumberofGroups = this->GetContributoryAmounts (mainPos);
Groups = new GROUPSTRUCT[NumberofGroups];


the first line allocates memory with new and assigns the pointer to Groups, but then you also do your own new and assign it to Groups. Therefore the previous assignment from NumberofGroups = this->GetContributoryAmounts (mainPos); is lost, and a memory leak.

Hope that helps.

Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
QuestionRe: the more leaks...... Pin
David Crow25-Oct-05 10:32
David Crow25-Oct-05 10:32 
Questionguarantee to run in a certain period Pin
LeeeNN25-Oct-05 8:14
LeeeNN25-Oct-05 8:14 
AnswerRe: guarantee to run in a certain period Pin
Roger Stoltz25-Oct-05 9:03
Roger Stoltz25-Oct-05 9:03 
AnswerRe: guarantee to run in a certain period Pin
Joe Woodbury25-Oct-05 12:01
professionalJoe Woodbury25-Oct-05 12:01 
AnswerRe: guarantee to run in a certain period Pin
Roger Stoltz25-Oct-05 22:56
Roger Stoltz25-Oct-05 22:56 
GeneralRe: guarantee to run in a certain period Pin
Joe Woodbury26-Oct-05 0:22
professionalJoe Woodbury26-Oct-05 0:22 
QuestionDesign advice needed Pin
Keith Vitali25-Oct-05 8:03
Keith Vitali25-Oct-05 8:03 
AnswerRe: Design advice needed Pin
Achim Klein25-Oct-05 8:31
Achim Klein25-Oct-05 8:31 
AnswerRe: Design advice needed Pin
John R. Shaw25-Oct-05 9:03
John R. Shaw25-Oct-05 9:03 
GeneralRe: Design advice needed Pin
Keith Vitali26-Oct-05 9:15
Keith Vitali26-Oct-05 9:15 
AnswerRe: Design advice needed Pin
Joe Woodbury25-Oct-05 12:06
professionalJoe Woodbury25-Oct-05 12:06 
AnswerRe: Design advice needed Pin
User 58385225-Oct-05 17:21
User 58385225-Oct-05 17:21 
QuestionMalloc / Free problem Pin
Jader8925-Oct-05 6:45
Jader8925-Oct-05 6:45 
AnswerRe: Malloc / Free problem Pin
Roger Stoltz25-Oct-05 7:01
Roger Stoltz25-Oct-05 7:01 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:31
Jader8925-Oct-05 7:31 
AnswerRe: Malloc / Free problem Pin
Maximilien25-Oct-05 7:10
Maximilien25-Oct-05 7:10 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:33
Jader8925-Oct-05 7:33 

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.