Bonjour,
je constate un problème avec la fonction malloc sous XP SP3 32bits,
le programme s'arrêt sans message de defaut,
la structure BLOCKDD a une taille de 2976 octets et le programme s'arrête lors de la 111 allocation dynamique !!!
Quelle limite est atteinte ?


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
DPrintf2("ReadCSVP 1d   bloc:%s found \r\n",szText15);
safe_strncpy(memCurBlock,szCurBlock,sizeof(memCurBlock)); // memorize the block name (with the hierarchy)
planhierarch[0]='\0';
g_BlockIndex = ++(pBlocks->nBlock);   // nBlock = Number of readed DigDevice blocks into the readcsv file
DPrintf2(" ReadCSVP 1e   bloc:%s found  g_BlockIndex=%d r\n",szText15,g_BlockIndex);
unitBlockDD=(BLOCKDD*) alloc(sizeof(BLOCKDD)); // allocate memory for the new block
DPrintf2(" ReadCSVP 1f  bloc:%s found  g_BlockIndex=%d malloc:%d\r\n",szText15,g_BlockIndex,unitBlockDD);
pBlocks->unitBlock[g_BlockIndex-1]=(void*)unitBlockDD;
if (unitBlockDD==0)
{
DPrintf("EEE ReadCSVP    !!! OUT OF MEMORY BLOCK DCD !!!\r\n");
memset(unitBlockDD,0,sizeof(BLOCKDD)); // reset the allocated memory
}

typedef struct{
    char tagname[256];// hierarchy for tag name construction
    char     interlock_texts[DDMAXINTLOCK][DDTEXMAXLEN];// Array with 40-character strings to save the 10 interlock texts
    char    interconnection_texts[DDMAXINTLOCK][DDTEXCMAXLEN];// Array with 90-character strings to save the 10 interconnection texts
    char     logic_texts[DDMAXLOGIC][DDTEXMAXLEN];// Array with 90-character strings to save the 16 logic texts
    char    szFEEDB1[DDTEXMAXLEN];              // FEEDBACK 1
    char    szFEEDBC1[DDTEXCMAXLEN];            // FEEDBACK 1
    char    szFEEDB2[DDTEXMAXLEN];              // FEEDBACK 2
    char    szFEEDBC2[DDTEXCMAXLEN];            // FEEDBACK 2
    char    szLOCAL[DDTEXMAXLEN];              // LOCAL
    char    szLOCALC[DDTEXCMAXLEN];            // LOCAL
    char    szMTR_PROT[DDTEXMAXLEN];          // MPR_PROT
    char    szMTR_PROTC[DDTEXCMAXLEN];        // MPR_PROT
    char    szCMD1[DDTEXMAXLEN];              // CMD 1 
    char    szCMDC1[DDTEXCMAXLEN];            // CMD 1 
    char    szCMD2[DDTEXMAXLEN];              // CMD 2
    char    szCMDC2[DDTEXCMAXLEN];            // CMD 2
    char    szQMON[DDTEXCMAXLEN];            // QMON ERROR
} BLOCKDD;    // size= 256 + 10*40 + 10*90 + 16*40 + 6*40 + 6*90 = 2976
Détail de mon fichier Log :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
[2011-09-17 09:43] ReadCSVP 1d  bloc:DCDL_Ext found
[2011-09-17 09:43] ReadCSVP 1e  bloc:DCDL_Ext found  g_BlockIndex=110 
[2011-09-17 09:43] ReadCSVP 1f   bloc:DCDL_Ext found  g_BlockIndex=110  malloc:309754408
[2011-09-17 09:43] ReadCSVP DIG_DEVICELOG_EXT_CODE   110 
[2011-09-17 09:43] ReadCSVP 1d   bloc:DCDL_Ext found 
[2011-09-17 09:43] ReadCSVP 1e   bloc:DCDL_Ext found g_BlockIndex=111
le programme s'est arrêté ReadCSVP 1f n'a plus été écrit dans le log.