Hi All, I would like to ask regarding the possible overhead/performance issue for an application (DLL) to create an object (call NEW) and destroy the object (DELETE) every 1 second? Thanks so much. not so newbie :)
ginjikun
Posts
-
overhead of NEW and DELETE -
AuthenticationHi All, Would like to ask regarding DCOM authentication... in calling the function CoCreateinstanceEx with correct user name and password are provided why does the access denied error is still still encountered? how are these information (username and password) actually used? Does the initial call to CoCreateInstanceEx passing the username and password also affects other calls like QueryInterface or other functions? Thanks so much for any clarications about this. ginji
-
string conversionHi, thanks again. since it is an mfc project i just cast it to CString instead. func((CString)LPWSTR) i think this should be ok... ??? me
-
string conversionHi, thanks for the reply! the assignment is just a sample.. however i am more concern with how FUNC is being called. you mentioned it will work only on UNICODE. what if the project is compiled with _MBCS, will FUNC((LPCTSTR)str) still work? thanks! me
-
string conversionhi Rajkumar R, what if the project is compile with _MBCS? will it still be ok? thanks
-
string conversionHi All! just wanted to ask, if i have a function which expects a LPCTSTR.. is it ok to call it as shown below func(LPCTSTR lp) { .... } 1) CString str="something"; func(str); 2) LPWSTR str="something"; <-- just a sample, not sure how to set a LPWSTR type func((LPCTSTR)str); thanks! me
-
DLL Function calldoes named pipe count? if the function is writing to the named pipe and the function is called in parallel will that be a problem? or does named pipe handle that scenario automatically? if not then i should only call the write function to the named pipe one at a time. :)
-
DLL Function callthen my question next question will be if the named pipe is used only by that function.. however if that function is called in parallel causing 2 or more writing in the named pipe will that be a problem? or is it automatically handled by the named pipe that if there is currently a write in progress then other write functions will not interfere until it is finished? :)
-
DLL Function callhi thanks for the answer.... now my problem is if i dont use a lock within the function... and the function is as shown below void function(myobj* obj) { myobj *objTemp = new myobj; objTemp->a = obj->a; // or if i use memcpy here send to namepipe... } will there be a problem if the function is called in parallel? thanks again. :)
-
DLL Function callim not sure if i understand what you meant by a the global resource... however the struct myobj as shown before is created everytime the function is called and sent as a data to a named pipe then the function returns. will there be a problem in that case? :)
-
DLL Function callsorry but what do you mean by global pool? thanks. not so newbie :)
-
DLL Function callHi! thanks so much for the answer. if the function does not use global resoure and is something like below void Function(myobj *obj){ myobj* objTemp = new myobj; objTemp->a = obj->a; }; will there be a problem if the function is called by multiple threads? thanks again! not so newbie :)
-
DLL Function callHi everyone! Would like to ask... if i have a DLL that implements a function.. this DLL is used by an EXE. can the call to the DLL function by the EXE be done in parallel? say the EXE implements several thread and each of these threads calls the DLL function. or is the call just 1 at a time? Thanks for any help. not so newbie :)
-
NamedPipe Error in CreateFileHi Llasus! the "function1 exit" was printed after it encountered the error "The system cannot find the file specified.". function1 called is just like as i have posted it less the checking and the other function calls like PeekNamedPipe to avoid cluter. it just calls CreateFile if successful then calls WriteFile and then calls ReadFile then CloseHandle. but in CreateFile it already fails function1(pipename, data) { if(CreateFile(pipename...)) { WriteFile(data...); ReadFile(reply...); Closehandle(...); } else { Log(GetLastError()); } } thanks again! old
-
NamedPipe Error in CreateFileHi Llasus! the "function1 exit" was printed after it encountered the error "The system cannot find the file specified.". function1 called is just like as i have posted it less the checking and the other function calls like PeekNamedPipe to avoid cluter. it just calls CreateFile if successful then calls WriteFile and then calls ReadFile then CloseHandle. but in CreateFile it already fails function1(pipename, data) { if(CreateFile(pipename...)) { WriteFile(data...); ReadFile(reply...); Closehandle(...); } else { Log(GetLastError()); } } thanks again! old
-
NamedPipe Error in CreateFileHey Luc! thanks! yes it does. it checks for errors everywhere :) and it calls GetLastError to log the error encountered. i have tried to add locking in function1 and have left it running for over 2 hours now. so far it is still running! no global variables are used. all are local variables which are parameters. ooopss forgot to mention function1 takes the parameters pipename (complete with machine to connect) and the data to be sent. function1(pipename, data) i am still lost as how exported functions behave. is it blocking? if it has no locking and was called at the same time (almost the same time :) ) what will happen? thanks! thanks! old
-
NamedPipe Error in CreateFileHi Llasus! thanks! i have added some code in my latest reply to Luc. please refer to that one. i have checked the log file and have so far found no failure in the releasing of the named pipe connection. also, if ever there are no more instances for the pipe to connect to, shouldnt the error be pipe busy or something similar to that? from the description "The system cannot find the file specified." what i understand is that it is trying to connect to something which does not exist. i am not sure though :(( thanks for the help! old
-
NamedPipe Error in CreateFileHi again Luc! and thanks again for the reply. what i mean by concurrent call to CreateFile was that there was 2 calls to the functions i have created which calls CreateFile. i have a DLL which have exported functions for sending data. sample code is... in my DLL function1() { Log("function1 Entry"); CreateFile(..); WriteFile(..); ReadFile(..); CloseHandle(..); Log("function1 Exit"); } there is no lock in function1. in the logging i saw "function1 Entry" "function1 Entry" which means that 2 calls to this function was made even before the 1st call has finished. ideally that log should be like this "function1 Entry" "function1 Exit" "function1 Entry" "function1 Exit" after i saw the log which have 2 entries "function1 Entry" then all succeeding logs was the failed in CreateFile. maybe the issue is not the concurrent call to CreateFile but it is in the function whereby the first call has connected already then another calls CreateFile again. will this invalidated the pipe instance previously created? i guess another question should be what if a function was called concurrently when it has not yet finished its previous processing, what will be the effect? im lost :sigh: thanks for the help! old
-
NamedPipe Error in CreateFileHi Luc! thanks for the reply! yes, once it fails, it fails completely. no more CreateFile call is successful. i am not sure how many successful connection were made. there was a lot since i was running it for a few hours already and every 1 minute i am sending some data. no clients so far based on the logging terminated abonormally. though i noticed in the logging that there was a concurrent call to CreatFile then it started to fail. that is why i am asking what the effect is if 2 concurrent calls to CreateFile was made on the same pipe server. thanks so much! old
-
NamedPipe Error in CreateFileHi again! Yes, there is only 1 pipe server creating 25 instances to enable at least 25 clients to connect. something like this for the server for (;;) { CreateNamedPipe( ..., 25, // instances ... ); // wait for clients to connect ConnectNamedPipe(...); ... ReadFile(...); WriteFile(...); DisconnectNamedPipe(...); CloseHandle(...); } the client... CreateFile(...); WriteFile(...); ReadFile(...); CloseHandle(...); again, it was working fine for a few hours then suddenly i get the error "The system cannot find the file specified." i am not sure what happened. the namedpipe server is still running. thanks again! old