Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: office look not supported in VC .NET 2005 Pin
giddy_guitarist29-Jul-06 21:29
giddy_guitarist29-Jul-06 21:29 
GeneralRe: office look not supported in VC .NET 2005 Pin
Justin Tay29-Jul-06 23:15
Justin Tay29-Jul-06 23:15 
QuestionLowerCase(char stringtoConvert) Pin
jon-8029-Jul-06 6:35
professionaljon-8029-Jul-06 6:35 
AnswerRe: LowerCase(char stringtoConvert) Pin
Maxwell Chen29-Jul-06 7:27
Maxwell Chen29-Jul-06 7:27 
Questionalloc memory, debug and release Pin
includeh1029-Jul-06 4:48
includeh1029-Jul-06 4:48 
AnswerRe: alloc memory, debug and release Pin
Maxwell Chen29-Jul-06 7:34
Maxwell Chen29-Jul-06 7:34 
AnswerRe: alloc memory, debug and release Pin
Chris Losinger29-Jul-06 9:05
professionalChris Losinger29-Jul-06 9:05 
AnswerRe: alloc memory, debug and release [modified] Pin
Rilhas4-Aug-06 11:10
Rilhas4-Aug-06 11:10 
For the application to crash in the call to "new" one or both of the situations below may be hapening:

1) You call new 1 and then trash the memory thus making new 2 fail because the heap memory list gets corrupted.

2) The new is creating an object which has an error in the constructor and so crashes the application during construction.

To determine what might be happening try the following code:

#include <stdio.h>

void main(void) {
long ttsz=0;
long bsz;
char* bp;
while(1) {
printf("Input size (in KB): ");
scanf("%d", &bsz);
bsz*=1024;
printf("Allocating a size of %d\n", bsz);
bp=new char[bsz];
printf("Allocated a size of %d into 0x%p\n", bsz, bp);
ttsz+=bsz;
printf("Total allocated size (in KB): %d\n", ttsz/1024);
printf("\n");
}
}

I tried this code several times and it works fine.

You should use GlobalAlloc only when strictly necessary. It is not as simple nor as portable as new.

I hope this helps,
Rilhas



-- modified at 17:10 Friday 4th August, 2006
QuestionPacket Filtering API failing Pin
_tasleem29-Jul-06 4:38
_tasleem29-Jul-06 4:38 
QuestionA simple question on PreTranslateMessage and ON_WM_ Pin
Jay Zhu29-Jul-06 4:04
Jay Zhu29-Jul-06 4:04 
AnswerRe: A simple question on PreTranslateMessage and ON_WM_ Pin
includeh1029-Jul-06 5:03
includeh1029-Jul-06 5:03 
GeneralRe: A simple question on PreTranslateMessage and ON_WM_ Pin
Jay Zhu29-Jul-06 6:27
Jay Zhu29-Jul-06 6:27 
GeneralRe: A simple question on PreTranslateMessage and ON_WM_ [modified] Pin
Justin Tay29-Jul-06 7:37
Justin Tay29-Jul-06 7:37 
GeneralRe: A simple question on PreTranslateMessage and ON_WM_ Pin
Jay Zhu29-Jul-06 18:34
Jay Zhu29-Jul-06 18:34 
GeneralRe: A simple question on PreTranslateMessage and ON_WM_ Pin
Jay Zhu29-Jul-06 18:49
Jay Zhu29-Jul-06 18:49 
GeneralRe: A simple question on PreTranslateMessage and ON_WM_ Pin
Justin Tay29-Jul-06 19:59
Justin Tay29-Jul-06 19:59 
Questiona Simple Question about ON_MESSAGE and ON_NOTIFY Pin
JackNotAll29-Jul-06 3:03
JackNotAll29-Jul-06 3:03 
AnswerRe: a Simple Question about ON_MESSAGE and ON_NOTIFY Pin
Ryan Binns29-Jul-06 5:18
Ryan Binns29-Jul-06 5:18 
GeneralRe: a Simple Question about ON_MESSAGE and ON_NOTIFY Pin
JackNotAll30-Jul-06 3:25
JackNotAll30-Jul-06 3:25 
GeneralRe: a Simple Question about ON_MESSAGE and ON_NOTIFY Pin
Ryan Binns30-Jul-06 4:44
Ryan Binns30-Jul-06 4:44 
GeneralRe: a Simple Question about ON_MESSAGE and ON_NOTIFY Pin
JackNotAll30-Jul-06 19:26
JackNotAll30-Jul-06 19:26 
QuestionTransparent checkboxes Pin
Twister33629-Jul-06 1:22
Twister33629-Jul-06 1:22 
AnswerRe: Transparent checkboxes Pin
includeh1029-Jul-06 5:11
includeh1029-Jul-06 5:11 
GeneralRe: Transparent checkboxes Pin
Twister33629-Jul-06 5:46
Twister33629-Jul-06 5:46 
GeneralRe: Transparent checkboxes Pin
anthonym728-Aug-06 5:55
anthonym728-Aug-06 5:55 

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.