Memory Overwrite
-
Hi, I have noticed a strange behaviour in my app. I have 4 staic items: static char* manuf[512]; static int link_man[512]; static char* comp[128]; static CDatasheet DS; where CDatasheet is a class derived from CObject. Filling in the manuf array, when I reach the 264th item, the app starts overwriting the memory space allocated for the DS object. So any assignment operation to that object produces an error. Any suggestion? Another question: I tried to remove the DS object (commented out), but the compiler still build the app. I parsed all my files, but there are no other declaration for that object. What can it be happened? Thanks Dwarfpower
-
Hi, I have noticed a strange behaviour in my app. I have 4 staic items: static char* manuf[512]; static int link_man[512]; static char* comp[128]; static CDatasheet DS; where CDatasheet is a class derived from CObject. Filling in the manuf array, when I reach the 264th item, the app starts overwriting the memory space allocated for the DS object. So any assignment operation to that object produces an error. Any suggestion? Another question: I tried to remove the DS object (commented out), but the compiler still build the app. I parsed all my files, but there are no other declaration for that object. What can it be happened? Thanks Dwarfpower
vilmer wrote: static char* manuf[512]; vilmer wrote: Filling in the manuf array, when I reach the 264th item, the app starts overwriting the memory space allocated for the DS object. So any assignment operation to that object produces an error. How are you filling the array ? You know that manuf is an array of pointers, and not a string ? You have an array of 512 'strings' that are undefined (that is all adresses are invalid at the begining). Post the code, so maybe we can help you.
-
vilmer wrote: static char* manuf[512]; vilmer wrote: Filling in the manuf array, when I reach the 264th item, the app starts overwriting the memory space allocated for the DS object. So any assignment operation to that object produces an error. How are you filling the array ? You know that manuf is an array of pointers, and not a string ? You have an array of 512 'strings' that are undefined (that is all adresses are invalid at the begining). Post the code, so maybe we can help you.