a problem in memory allocation
-
Hi everybody, I have a strange problem with an allocation of memory for pointers of pointers. i have done this function to allocate memory for 2 pointers of pointers: void LoadHistoDB::AllocComptStartEndMin(long RowSize,long ColSize) { long i; pComptStartMineure=new double* [RowSize]; pComptEndMineure=new double* [RowSize]; for(i=0;i120 i could see in the debug window this message in front of pComptStartMineure: CXX0030:expression cannot be evaluated and i could see this same message for pComptEndMineure when i>202. So where is the problem? Thanks in advance for your help gérald
-
Hi everybody, I have a strange problem with an allocation of memory for pointers of pointers. i have done this function to allocate memory for 2 pointers of pointers: void LoadHistoDB::AllocComptStartEndMin(long RowSize,long ColSize) { long i; pComptStartMineure=new double* [RowSize]; pComptEndMineure=new double* [RowSize]; for(i=0;i120 i could see in the debug window this message in front of pComptStartMineure: CXX0030:expression cannot be evaluated and i could see this same message for pComptEndMineure when i>202. So where is the problem? Thanks in advance for your help gérald
When i>120 i could see in the debug window this message in front of pComptStartMineure: CXX0030:expression cannot be evaluated `that means that your pointer is pointing to NULL, hence it can not evaluated the value. Normally, an attempt to access NULL pointer will give you "Access Violation" error. This dynamic memory allocation is not easy to deal with. Ideally you'll need to go step by step through each line of code and monitor your program and see what is an unexpected result.`
-
When i>120 i could see in the debug window this message in front of pComptStartMineure: CXX0030:expression cannot be evaluated `that means that your pointer is pointing to NULL, hence it can not evaluated the value. Normally, an attempt to access NULL pointer will give you "Access Violation" error. This dynamic memory allocation is not easy to deal with. Ideally you'll need to go step by step through each line of code and monitor your program and see what is an unexpected result.`
I try to follow first the allocation describe by the function called AllocComptStartEndMin, and you know as usual when you do the allocation of memory for a pointer of "double" for example, p=new double[X]; when you try to see what are the value, for each i from 0 to to X-1 of p[i], (before any affectation), in the debug window, you have in this window: p[i] in the column "Name" and -6.2774385...e+066 in "Value" column. So when i execute step by step AllocComptStartEndMin, it works even if i>120. So, why when i want to affect value to the pointers i can't affect value for the first pointer when i>120 ( and what is very strange is this value:120, because in my sample RowSize =866 and ColSize=255!)