Click here to Skip to main content
15,892,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: OPENFILENAME question Pin
David Crow21-Jul-06 3:08
David Crow21-Jul-06 3:08 
AnswerRe: OPENFILENAME question Pin
ThatsAlok21-Jul-06 3:11
ThatsAlok21-Jul-06 3:11 
AnswerRe: OPENFILENAME question Pin
Hamid_RT21-Jul-06 3:52
Hamid_RT21-Jul-06 3:52 
Question[SOLVED - see last post] Help needed: another strange calloc/malloc issue [modified] Pin
lyuabe21-Jul-06 0:30
lyuabe21-Jul-06 0:30 
AnswerRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt21-Jul-06 1:03
Stephen Hewitt21-Jul-06 1:03 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe21-Jul-06 1:14
lyuabe21-Jul-06 1:14 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Cedric Moonen21-Jul-06 1:16
Cedric Moonen21-Jul-06 1:16 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe21-Jul-06 1:24
lyuabe21-Jul-06 1:24 
Sorry, the original code is like this (with calloc):
<br />
double *temp_radiale = (double*)calloc(grid->n_rad,sizeof(double));<br />
double *delta_temp_radiale = (double*)calloc(grid->n_rad,sizeof(double));<br />
double *avg_rad_energy = (double*)calloc(grid->n_rad,sizeof(double));<br />

then the code crashed, I guess because when the 3rd calloc tries to access the memory which has already been allocated by the second one, it crashes.

So I tried the following:
<br />
double *temp_radiale = (double*)malloc(grid->n_rad*sizeof(double));<br />
double *delta_temp_radiale = (double*)malloc(grid->n_rad*sizeof(double));<br />
double *avg_rad_energy = (double*)malloc(grid->n_rad*sizeof(double));<br />
<br />
#ifdef _DEBUGOOO<br />
	printf("%x %x %x\n",temp_radiale,delta_temp_radiale,avg_rad_energy);<br />
#endif<br />

which actually displays the two identical pointers delta_temp_radiale and avg_rad_energy. But at the end of this subroutine, when I free, it crashes, obviously.
QuestionRe: Help needed: another strange calloc/malloc issue Pin
David Crow21-Jul-06 3:12
David Crow21-Jul-06 3:12 
GeneralRe: Help needed: another strange calloc/malloc issue [modified] Pin
cmk21-Jul-06 4:33
cmk21-Jul-06 4:33 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe21-Jul-06 7:15
lyuabe21-Jul-06 7:15 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt21-Jul-06 1:16
Stephen Hewitt21-Jul-06 1:16 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe21-Jul-06 1:26
lyuabe21-Jul-06 1:26 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt21-Jul-06 2:51
Stephen Hewitt21-Jul-06 2:51 
AnswerRe: Help needed: another strange calloc/malloc issue Pin
Steve S21-Jul-06 1:03
Steve S21-Jul-06 1:03 
AnswerRe: Help needed: another strange calloc/malloc issue [modified] Pin
Jonas Hammarberg21-Jul-06 1:40
professionalJonas Hammarberg21-Jul-06 1:40 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe21-Jul-06 1:18
lyuabe21-Jul-06 1:18 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt21-Jul-06 3:05
Stephen Hewitt21-Jul-06 3:05 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe21-Jul-06 7:23
lyuabe21-Jul-06 7:23 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt21-Jul-06 18:56
Stephen Hewitt21-Jul-06 18:56 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe29-Jul-06 2:24
lyuabe29-Jul-06 2:24 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt29-Jul-06 2:39
Stephen Hewitt29-Jul-06 2:39 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe29-Jul-06 5:47
lyuabe29-Jul-06 5:47 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
Stephen Hewitt29-Jul-06 16:33
Stephen Hewitt29-Jul-06 16:33 
GeneralRe: Help needed: another strange calloc/malloc issue Pin
lyuabe30-Jul-06 15:56
lyuabe30-Jul-06 15:56 

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.