Page 3 of 4

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Mon Sep 02, 2013 2:16 pm
by mariosk8s
This is a real cool add-in.
Now i only wonder if there's a way to get a call stack of some sort to be included.
That way when an allocate is in a nested function that's called from a lot of different places, we could find out who the evildoer was.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Tue Sep 03, 2013 5:07 am
by sec
@luis: Could you please update this to last version?

Thanks.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Tue Sep 03, 2013 11:29 am
by luis
sec wrote:@luis: Could you please update this to last version?
Doesn't it work already ? I tried with the last 5.20 beta and unless I'm missing something it does.

Only problem I see is in the demo the allocation of 99,999,999,999 bytes does not fail, I seem to recall in older version did so (don't remember which version).

Why does not fail BTW ? I understand the pointer returned is not to physical memory but nevertheless... but maybe what's changed is the underlying OS and not something inside PB ?

Practically allocatememory() never fails today until something horrible happen with the entire OS running out of resources ?


EDIT: now there is something else I don't understand. Currently PB should fill with zeros the allocated memory (by default).
So the OS should be forced not only to "virtually" reserve the memory, but to actually commit it since the memory is actually accessed.
How can the allocation above be successful then ?

EDIT 2: actually it does fail, phew, there was an overflow so the allocated memory was a lot less. I'll change it in the version updated for PB 5.20.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 11:38 am
by luis
@sec

You asked me to update the code to the latest PB version.
I took the time to check it, and I've reported back.
The question I made was not a rhetorical one.
Doesn't it work already ? I tried with the last 5.20 beta and unless I'm missing something it does.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 11:43 am
by sec
@luis: I am not expert at hunting the bugs.

I am trying code at your first post with 5.20, it says missing parameters at AllocateMemory, ReAllocateMemory, ...

Thanks

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 11:48 am
by luis
Really ? I'll test it again. One of us is probably drunk, mybe I'm the one :mrgreen:

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 11:52 am
by luis
I just tried, I had the doubt of have used the wrong compiler.
I tried with 5.20 beta 16, x86, under Windows.

It works. :?:

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 11:55 am
by sec
luis wrote:Really ? I'll test it again. One of us is probably drunk, mybe I'm the one :mrgreen:
Yes :mrgreen:

My project has 'refresh' feature', it is increasing 4K after each 'refresh' . bUt i can't find where is root of cause problem.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 11:57 am
by sec
luis wrote:I just tried, I had the doubt of have used the wrong compiler.
I tried with 5.20 beta 16, x86, under Windows.

It works. :?:
for example:

Code: Select all

  *Buffer = AllocateMemory(1024, #PB_Memory_NoClear)

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 12:07 pm
by luis
AAAAAH, I think I understand.

You are telling me it doesn't work wit YOUR code, not with MY EXAMPLE.

Right ?

Problem is I was testing what is posted HERE and thought you were doing the same, logically :wink:


OK, newer PB versions added a new param to allocatememory and in your code you are using it.

The code need to be updated to work with that, I'll do it as I have a moment, probably this evening.

I'll check the other commands too.

OK ? Bye!

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 12:10 pm
by sec
luis wrote:AAAAAH, I think I understand.

You are telling me it doesn't work wit YOUR code, not with MY EXAMPLE.

Right ?

Problem is I was testing what is posted HERE and thought you were doing the same, logically :wink:


OK, newer PB versions added a new param to allocatememory and in your code you are using it.

The code need to be updated to work with that, I'll do it as I have a moment, probably this evening.

OK ? Bye!
Yes, thanks you :mrgreen:

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Thu Sep 05, 2013 9:39 pm
by luis
@sec

Should be ok, give it a try and let me know if I forgot something.
Thanks.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Fri Sep 06, 2013 3:18 am
by sec
luis wrote:@sec

Should be ok, give it a try and let me know if I forgot something.
Thanks.
I get macro error:

Code: Select all

Global remote_host_img = _CatchImage (#PB_Compiler_File, #PB_Compiler_Line, 9, ?my_png,  $7FFFFFFF)

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Fri Sep 06, 2013 8:33 am
by mariosk8s
sec wrote:My project has 'refresh' feature', it is increasing 4K after each 'refresh' . bUt i can't find where is root of cause problem.
Try, checking that you call ClearStructure on all the Structs you free. NoLeak doesn't catch that and it can cause leaks.

Re: NoLeak - include to help you find memory leaks (1.3)

Posted: Fri Sep 06, 2013 8:51 am
by sec
mariosk8s wrote:
sec wrote:My project has 'refresh' feature', it is increasing 4K after each 'refresh' . bUt i can't find where is root of cause problem.
Try, checking that you call ClearStructure on all the Structs you free. NoLeak doesn't catch that and it can cause leaks.
@mariosk8s: Thanks,

Never hear about ClearStructure before.

Code: Select all

Threaded NewMap cserver.serverinfo()
ClearMap(cserver()) is equal ClearStructure(@cserver(), serverinfo) ?