Hi it seems you get it wrong. I am not talking about memory leaks, leaks I am talking about handle leaks. If I open task manager and look handle count for my application it used to increased by 2 at every connect trial...
chevu
Posts
-
Handle leaks in WinSock - WIndows Application (MFC) -
Handle leaks in WinSock - WIndows Application (MFC)Ya those things we have added just to check whether they could help us to reduce handle leaks but it dint help us. We also use pointer approach also but it dint help us either... This code is being used in one of the windows service which we use to activate manually..
-
Copying From Single Dimension Array To Multiple Dimension ArrayAnd ya if you don't want to new memory allocation you can directly assign address of arr to arr3, but for that in your function your have to send address of arr3 pointer i mean &arr3 (which you have declared as int** arr3), and in function you can assign address of arr to arr3....
-
Copying From Single Dimension Array To Multiple Dimension ArrayAre trying to transfer content of arr to arr3, right? But I am not able to see any memory allocation for arr3... You have to allocate some memory.. The way you are doing wont be safe in terms of memory pointer usage.. You can do something like this...
case 1: assigning direct pointer of arr to arr3
arr3 = new int[SIZE];
/* for loop with i*/
arr3[i] = &(arr[UPTO_SIZE])case 2: copyinh content of arr to arr3
arr3 = new int[SIZE];
/* for loop upto size */
arr3[i] = new int[size2]/* copy logic from arr to arr3*/
I hope you can add proper code in this logic... As we cannot complete your assignment... :D
-
Handle leaks in WinSock - WIndows Application (MFC)Hi, We are developing an application in which for comminication to outside module we are using WinSock based sime socket approach. Our requirement is to make sure connection will always be on, so for that reason when ever we are getting disconnected or not able to connect to outside module we keep trying after every 1 minute. Our problem starts here we have observered that on every retry of socket reconnect it is leaking exact 2 windows handles, we have tried so many options but none of them are working. Following is the code that we are using right now,
bool CSocketClass::ConnectToServer(int nLineNo)
{
string strIPAddress;
int nPortNo;
SOCKET* l_ClientSocket;
int ConnectionResult;//---------------------- // Create a SOCKET for connecting to server if (nLineNo == 1) { m\_objLine1.m\_ClientSocket = socket(AF\_INET, SOCK\_STREAM, IPPROTO\_TCP); strIPAddress = m\_objLine1.m\_strIPAddress; nPortNo = m\_objLine1.m\_nPortNo; l\_ClientSocket = &(m\_objLine1.m\_ClientSocket); } else { m\_objLine2.m\_ClientSocket = socket(AF\_INET, SOCK\_STREAM, IPPROTO\_TCP); strIPAddress = m\_objLine2.m\_strIPAddress; nPortNo = m\_objLine2.m\_nPortNo; l\_ClientSocket = &(m\_objLine2.m\_ClientSocket); } if(INVALID\_SOCKET == \*l\_ClientSocket) { closesocket(\*l\_ClientSocket); return false; } //---------------------- // The sockaddr\_in structure specifies the address family, // IP address, and port of the server to be connected to. sockaddr\_in clientService; clientService.sin\_family = AF\_INET; clientService.sin\_addr.s\_addr = inet\_addr( strIPAddress.c\_str() ); clientService.sin\_port = htons( nPortNo ); //---------------------- // Connect to server. ConnectionResult = connect( \*l\_ClientSocket, (SOCKADDR\*) &clientService, sizeof(clientService) ) ; if (ConnectionResult == SOCKET\_ERROR) { if (nLineNo == 1) { //ERROR in line1 } else { //ERROR in line2 } closesocket(\*l\_ClientSocket); return false; } else //In case of successful connection { //Other actions } return true;
}
Can anyone help me? Thanks in advance.
-
Same Resource IDs in resource.hMake sure that 1. all the resourses ids (like dialog) that are being used in these files are less than _APS_NEXT_RESOURCE_VALUE 2. all the control ids (i.e. button, textbox) are less than _APS_NEXT_CONTROL_VALUE value. 3. all commands (keyboard shortcuts) you have added should less than _APS_NEXT_COMMAND_VALUE Hope it will solve your problem.
-
Use of Non-Unicode DLL in Unicode projectHi, Lets say, I am having Vendor dll and it is non-unicode. I want to use this dll in my Application and it is unicode. DLL is built using SDK functions such way that I cannot make is Unicode, same with Application it cannot build without unicode (frame work dependencies). Both of them are using CString. Is there any way possible by which I can use this dll in my application without changing their nature? Please let me know if further clarification needed. Thanks in advance.
-
MSXML2 - XML parser Memory LeakYa I am using task manager only. I also tried to save in thread but no improvements. Same behavior.
-
MSXML2 - XML parser Memory LeakHi, We are using Microsoft provided DOM parser - MSXML2 version 4(or 40) When we are saving XML file, we are generating whole new file including all nodes and elements. Size of XML file is 3.5 MB. So it is taking 350 MB memory (both virtual as well as physical) Once save is done we are releasing all the XML objects. But there is no change happening in memory. So every consecutive save keeps on increasing memory by 350MB (approx) After 3-4 save we have to restart application again. We have seen that if we minimize the application physical memory is coming back to original size (mean additional 350MB is getting reduced) but virtual memory is not changing. I think may be OS have reserved that place for application as memory cleaning is not done properly. But we have make sure that we have release all the memory we use. Some where on some forum we seen a work around like this,
VARIANT_BOOL bstatus;
m_pXMLDomDoc->loadXML(CComBSTR(""), &bstatus );
Release(m_pXMLDomDoc);That guy suggested that after you release saved document try to load a blank file. It will remove uncleaned area. But there is not much improvement. Please let me know if someone can help me.
-
infinite loop while using php's dir object..?cjoki, As per the mutual exclusion fundamental no mater what you are doing (read/write) with data (in this case reading file name) you cannot change that name. Ya but you might have seen in windows or unix or linux that in if you have opened one folder at two differ location and you add one file/folder at one place changes get reflected to another place. I am not so sure about windows directroy structure in detail. But for unix I know that once you add new file in directory its inode will be added to director file structure list and those changes can be read using directory structure. I dont know whether I am able to clarify your doubt or not. It will be better if you find out such script is working on your system and if it is not working then try to run such script and check. In both case please let me know the result I would like to know whether it is possible or not. Thanks.
-
infinite loop while using php's dir object..?Well I am not sure but according to OS fundamentals these things should be possible, 1) Rename and delete of directory not allowed 2) Rename and delete (and editing) is not allowed for the file getting processed in current loop instance 3) One should be able to rename or delete or editing a file which is not getting processed in current loop instance 4) One should be able to add new file in that directory. These all are theoretically, one can omit or change these rules for his OS. And sorry I haven't tried the situation you gave. But I think it should be possible. And it might led to infinite loop.
-
preg_split & foreach loop - $_POST variables into an array, then into MySQLHi, what you are trying to do it right. You can go with that pattern. You want some improved version then you can refer this link. http://php.net/manual/en/function.preg-split.php[^] They have included good number of example also. If you have already refer that page and you din't get any example then mention it so we can explain it.
-
MS Sql with phpIt is very generic question. It seems you want step by step tutorial. Try this manual http://php.net/manual/en/book.mssql.php[^]
-
confused MFC CREATING CLASS AND MESSASE HANDLEin that case can you give code of your DOMODAL function? if you want a simple work around then you can store that square root value in some global or class variable and then use it in parent dialog. But if you want to go with domodal then share that code. Thanks.
-
How to check memory how many?what kind of question it is? :doh:
-
Color For List View Control ColumnWell you question is to generic to have idea about your problem; can you please elaborate it further. After going through your question I think following link might help you to color individual column in listcontrol.. http://www.codeguru.com/cpp/controls/listview/backgroundcolorandimage/article.php/c4181[^]
-
Browser Support CheckIt seems some rookie has coded that script... :D ;P
-
php - include_onceHi, First of all, link given by you is not working.. Another thing is include_once can be used once check this php manual page. http://php.net/manual/en/function.include-once.php[^] Either explain your problem in detail or give sample code you are trying... So we can help you properly...
-
Ever heard of casting?what kind of comment was that?
-
Control Bar Focus Issue [modified] [SOLVED]hi u can us parentnotify... but why are you answering your own que? if you got the solution jst edit ur post title...