Home > Back-end >  Collapse, STD: : map. The find () for help
Collapse, STD: : map. The find () for help

Time:09-23

STD: : mapBegan a period of time is also good, after a period of time to collapse,
Will not be the thread problem, before the visit the thread lock,

CodePudding user response:

Put a string bai, don't use char *,

CodePudding user response:

reference 1st floor taodm response:
save a string bai, don't use char *.

So, belch fart...

CodePudding user response:

Collapse is inside of the find, if added to the string lock the problem and, if it is used to find the key value of has a problem, can't see the source of what is to say,

CodePudding user response:

Big probability is in other parts of the memory operations affect the storage structure of the map

CodePudding user response:

reference 4 floor mengwuxiy response:
big probability is in other parts of the storage structure of memory operations affect the map

Certainly not:
1, have a lock, release must not affect,
2, all is new,

CodePudding user response:

Willow mostly make uncertain problem must be a god, don't want to waste time, moved the bench look,

CodePudding user response:

refer to 6th floor taodm response:
willow mostly make uncertain problems must be a god, don't want to waste time, moved the bench see,

Dare not,
Skepticism thread problems, the improvement method is, will join the thread queue operations; Performed by the thread corresponding operation,

CodePudding user response:

reference cwenhe0324 reply: 3/f
is in the internal collapse of the find, if added to the string lock do you have any questions, if it is used to find the key value of has a problem, see the source code are not say what the situation of the

The key is a string, the function name, number 10, 16 Numbers,

CodePudding user response:

Now the solution are:
1, do not use a map, search for processing,
2, the use of thread, will work to add to the thread, first by a dedicated thread for processing,

CodePudding user response:

It is best to will be able to recreate the problem of code are posted, so that only one statement is difficult to locate the problem,

CodePudding user response:

Put something on the map, where there is any high-tech, code is simple:

Int gh_memory_record_increase (const void * pAddr, const int nSize,
Const char * pFile, const char * pFunction, const int nLine)
{
# if MEMORY_TRACE_FLAG
If (pAddr==NULL)
{
//GH_LOG_INFO (" addr=NULL, postion=% s to % s (% d) ", pFile, pFunction, nLine);
return -1;
}

Pthread_mutex_lock (g_pMemoryMutex);

//if (STRSTR (pFunction, "gh_mysql_query_camera_function")) GH_LOG_INFO (" size=% d, postion=% s to % s (% d) ", nSize, pFile, pFunction, nLine);
If (g_lStartTime==0)
{
G_lStartTime=TIMESTAMP ();
}

Char * pAddrKey=gh_memory_addr_to_key (pAddr);

GhMemoryRecord * pAddrRecord=(GhMemoryRecord *) malloc (sizeof (GhMemoryRecord));
Memset (pAddrRecord, 0, sizeof (GhMemoryRecord));
PAddrRecord - & gt; Addr=pAddr (void *);
PAddrRecord - & gt; Time=TIMESTAMP ();

PAddrRecord - & gt; Size_total=nSize;
PAddrRecord - & gt; Size_list [0]=nSize;
PAddrRecord - & gt; Size_count=1;

Sprintf (pAddrRecord - & gt; The file "% s", pFile);
Sprintf (pAddrRecord - & gt; The function, "% s", pFunction);
PAddrRecord - & gt; The line=nLine;

G_oMemoryRecordAddressMap [pAddrKey]=pAddrRecord;
//GH_LOG_INFO (addr=% s ", size=% d, postion=% s to % s (% d) ", the pKey, nSize, pFile, pFunction, nLine);

# if MEMORY_TRACE_FUNCTION_MAP
Char * pFuncKey=gh_memory_ffl_to_key (pFile, pFunction nLine);

//the second die here, why?
GH_LOG_HERE ();
STD: : mapGH_LOG_HERE ();
If (funcIter==g_oMemoryRecordFunctionMap. End ())
{
GhMemoryRecord * pFuncRecord=(GhMemoryRecord *) malloc (sizeof (GhMemoryRecord));
Memcpy (pFuncRecord pAddrRecord, sizeof (GhMemoryRecord));
G_oMemoryRecordFunctionMap [pFuncKey]=pFuncRecord;
}
The else
{
GhMemoryRecord * pFuncRecord=funcIter - & gt; Second;
If (pFuncRecord==NULL)
{
GH_LOG_HERE ();
}

PFuncRecord - & gt; Size_total +=nSize;
PFuncRecord - & gt; Size_list [pFuncRecord - & gt; size_count]=nSize;
PFuncRecord - & gt; Size_count + +;

Free (pFuncKey);
}
# endif

Pthread_mutex_unlock (g_pMemoryMutex);
# endif
return 0;
}

CodePudding user response:

Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand when double click on the next line, until we can read ,

CodePudding user response:

refer to 12 floor 4 teacher zhao reply:
collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand, until can read ,

Is not a WINDOWS, LINUX

CodePudding user response:

reference 13 floor LiuKunPeng reply:
Quote: refer to 12 floor 4 teacher zhao reply:

Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand, until can read ,

Is not a WINDOWS, LINUX

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related