Click here to Skip to main content
15,894,460 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem enumerating USB devices on my PDA (Windows Mobile 5.0) - project attached Pin
shpid3r9-Jun-09 9:37
shpid3r9-Jun-09 9:37 
GeneralRe: problem enumerating USB devices on my PDA (Windows Mobile 5.0) - project attached Pin
shpid3r9-Jun-09 9:49
shpid3r9-Jun-09 9:49 
Questionquestion regarding sockets Pin
mkrtchyanmarianna9-Jun-09 2:38
mkrtchyanmarianna9-Jun-09 2:38 
AnswerRe: question regarding sockets Pin
CPallini9-Jun-09 2:55
mveCPallini9-Jun-09 2:55 
Questionquestion regarding sockets Pin
mkrtchyanmarianna9-Jun-09 2:15
mkrtchyanmarianna9-Jun-09 2:15 
AnswerRe: question regarding sockets Pin
led mike9-Jun-09 4:33
led mike9-Jun-09 4:33 
QuestionDetermining efficiency / most-efficient algorithm [modified] Pin
Mike the Red9-Jun-09 1:16
Mike the Red9-Jun-09 1:16 
AnswerRe: Determining efficiency / most-efficient algorithm Pin
Stuart Dootson9-Jun-09 2:11
professionalStuart Dootson9-Jun-09 2:11 
GeneralRe: Determining efficiency / most-efficient algorithm Pin
Mike the Red9-Jun-09 2:24
Mike the Red9-Jun-09 2:24 
GeneralRe: Determining efficiency / most-efficient algorithm Pin
Stuart Dootson9-Jun-09 2:29
professionalStuart Dootson9-Jun-09 2:29 
AnswerRe: Determining efficiency / most-efficient algorithm Pin
led mike9-Jun-09 4:23
led mike9-Jun-09 4:23 
AnswerRe: Determining efficiency / most-efficient algorithm Pin
Chris Losinger9-Jun-09 5:02
professionalChris Losinger9-Jun-09 5:02 
Questionquestion regarding sockets Pin
mkrtchyanmarianna9-Jun-09 1:01
mkrtchyanmarianna9-Jun-09 1:01 
QuestionRe: question regarding sockets Pin
CPallini9-Jun-09 1:50
mveCPallini9-Jun-09 1:50 
AnswerRe: question regarding sockets Pin
mkrtchyanmarianna9-Jun-09 2:14
mkrtchyanmarianna9-Jun-09 2:14 
GeneralRe: question regarding sockets Pin
CPallini9-Jun-09 2:20
mveCPallini9-Jun-09 2:20 
QuestionLoadLibraryA & LoadLibraryW Pin
chirag_chauhan8-Jun-09 23:05
chirag_chauhan8-Jun-09 23:05 
AnswerRe: LoadLibraryA & LoadLibraryW Pin
Pops80028-Jun-09 23:18
Pops80028-Jun-09 23:18 
AnswerRe: LoadLibraryA & LoadLibraryW Pin
«_Superman_»8-Jun-09 23:24
professional«_Superman_»8-Jun-09 23:24 
GeneralRe: LoadLibraryA & LoadLibraryW Pin
chirag_chauhan8-Jun-09 23:31
chirag_chauhan8-Jun-09 23:31 
GeneralRe: LoadLibraryA & LoadLibraryW Pin
«_Superman_»8-Jun-09 23:34
professional«_Superman_»8-Jun-09 23:34 
AnswerRe: LoadLibraryA & LoadLibraryW Pin
KarstenK8-Jun-09 23:46
mveKarstenK8-Jun-09 23:46 
QuestionError while trying to free memory allocated using malloc Pin
dcj19848-Jun-09 23:04
dcj19848-Jun-09 23:04 
Hi, I am new to malloc and how it works. I have a pointer which I use as a "variable sized" array. When I try and free the memory that was allocated by malloc I get a "free(): invalid pointer: 0x0804b008" error". Does anyone know what the cause of this is? The memory is allocated deallocated as follows.

A function called initMatrices(); is called.

void initMatrices()
{
//Initialize the valid states array
forward_model.valid_states = (char *)malloc(2*forward_model.number_of_states*sizeof(*forward_model.valid_states));
}

forward_model is the name of the structure containing the array valid_states.

Then at the end of the program the function recycleMatrices(); is called.

void recycleMatrices
{
//Return the memory that was being used by the valid states array
free(forward_model.valid_states);
}

Am I doing something wrong? From all the tutorial/help pages I have found while googling this seems to be how the memory is freed, except none of the examples make use of a struct.

Any help would be appreciated.

Thanks
dcj
AnswerRe: Error while trying to free memory allocated using malloc Pin
CPallini8-Jun-09 23:10
mveCPallini8-Jun-09 23:10 
AnswerRe: Error while trying to free memory allocated using malloc Pin
chirag_chauhan8-Jun-09 23:11
chirag_chauhan8-Jun-09 23:11 

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.