mIRC Home    About    Download    Register    News    Help

Print Thread
#202782 29/07/08 11:49 PM
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Hello to you all,

I have been working with a dll that i have noticed since start that it leak memory.
After some fixes it doesn't leak that much but still there is something there leaking.

i got to the point of testing something like this:

int __declspec(dllexport) __stdcall query(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) {
return 3;
}

and leaks at same speed.

keep in mind that i can see the leak because i am running "query" 6000 times.

My question is that anyone has ever noticed something like this?
I believe there is a leak in the mirc dll call, but this is just a suspicion.
If i unload the dll all the mem is freed.

Thanks for your time.

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
correct me if I'm wrong (been a rather long time since I last used c++ :-P) but maybe you should clean up the char* yourself in that method or the destructor?

not sure if I'm saying something stupid anymore but java and .net have made me lazy over the years :-P


If it ain't broken, don't fix it!
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Hi m8, thanks for your feedback

I also suffer from java laziness smile
I have been looking for some codes of other dlls and i don't see any cleaning this parameter.

Still i may be missing something, i will do some tests

Regards

Last edited by tontito; 30/07/08 09:15 PM.
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Just found the problem.

It has nothing to do with mirc!

cheers

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
As a followup, never "cleanup" the *data pointer. mIRC makes use of, and expects it to exist. in fact, it's probably a pointer to a statically allocated structure anyway, so it's not even cleanable.

Rule of thumb: you're only ever responsible to free() what you've malloc()'d... *data isn't your responsibility.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
I stand corrected :-] thanks argv0 for the info


If it ain't broken, don't fix it!

Link Copied to Clipboard