Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Aradeonas
Yea it remove and even I remove all of the list items it get the same
result.
So Michael, what should I do about this? How can I really free it ?

Regards,
Ara


-- 
http://www.fastmail.com - Same, same, but different...


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Zeljko



On 10/24/2015 03:10 PM, Aradeonas wrote:

My question stand but I guess problem is in TObjectList but Im not sure
so I made a simple demo like this:

procedure TForm1.Button1Click(Sender: TObject);
var
   i: integer;
   b: TButton;
begin
   list := TObjectList.Create(True);
   for i := 0 to 1 do
   begin
 b := TButton.Create(Self);
 list.Add(b);
   end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
   list.Clear;
   list.Free;
end;

Form is clean and just have 2 button with their code so I run it and
memory usage in my Windows10 device is about 3mb and then hit the
button1 and memory goes up to 25mb and when I want to free and hit
button2 memory will decrease to 15mb not 3 , just like my main program
that I use TObjectList and will free its objects with remove
function but it will increase memory usage while running.
Did I miss something obvious?


Maybe TObjectlist.Clear does not free objects, in that case you have to 
iterate through TObjectList and use Remove() which will free objects ?


zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Michael Van Canneyt



On Sun, 25 Oct 2015, Zeljko wrote:




On 10/24/2015 03:10 PM, Aradeonas wrote:

My question stand but I guess problem is in TObjectList but Im not sure
so I made a simple demo like this:

procedure TForm1.Button1Click(Sender: TObject);
var
   i: integer;
   b: TButton;
begin
   list := TObjectList.Create(True);
   for i := 0 to 1 do
   begin
 b := TButton.Create(Self);
 list.Add(b);
   end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
   list.Clear;
   list.Free;
end;

Form is clean and just have 2 button with their code so I run it and
memory usage in my Windows10 device is about 3mb and then hit the
button1 and memory goes up to 25mb and when I want to free and hit
button2 memory will decrease to 15mb not 3 , just like my main program
that I use TObjectList and will free its objects with remove
function but it will increase memory usage while running.
Did I miss something obvious?


There is a difference between releasing an object in heap memory, 
and returning that memory to the OS: It's not because you've released 
the  memories from the various objects in the list, that the memory 
used by these objects is returned to the OS.


So what you observe is not necessarily an indication of a memory leak.

TObjectList does remove the objects from memory in a Clear.
If that would not work properly, we'd have heard a long time ago :)

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Michael Van Canneyt



On Sun, 25 Oct 2015, Aradeonas wrote:


Use another memory manager (?)


Can you explain more or give an example?


For example:
Just add cmem as the first unit in the uses clause, and you will be using the C 
memory manager.
It uses different algorithms.

You can write your own. But that is harder.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Working on big units

2015-10-25 Thread Graeme Geldenhuys
On 2015-10-25 00:58, Anthony Walter wrote:
> Graeme, all browsers (except opera mini) support h.264 now:

Yes and No. The difference between OGV & WebM vs H264 is that H264
requires external libraries for it to work. Especially on Linux or
FreeBSD (read the fine print... appropriate gstreamer plug-ins are
required).

On the other hand, OGV and WebM (I think) are fully baked into the
browser source code - just like JPG or GIF support. At least for Opera,
Chrome and Firefox.

Anything MPEG and H264 are patent nightmares and requires licensing. Do
some Google searching to find out more - there are tons of information,
especially for content producers (somebody making video files).


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread leledumbo
> I checked all of my objects and I free them,also I used DumpHeap for
finding memory leaks but its a big report and many other simple programs
have many report like this and I cant find anything good in it.

The leak reports lines from both your app and the underlying library you
use, i.e. LCL. Find the one from your app (./include/customcontrol.inc,
./include/whatever.inc certainly don't belong to your app), that's where you
should start tracing. It's sometimes obvious, sometimes not, no
generalization possible.



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Finding-memory-leaks-tp4044940p4044955.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Ondrej Pokorny

On 25.10.2015 14:36, Aradeonas wrote:

Yea it remove and even I remove all of the list items it get the same
result.
So Michael, what should I do about this? How can I really free it ?


Use another memory manager (?)

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Aradeonas
> Use another memory manager (?)

Can you explain more or give an example?

Regards, Ara


-- 
http://www.fastmail.com - Accessible with your email software
  or over the web

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding memory leaks

2015-10-25 Thread Ondrej Pokorny

On 25.10.2015 17:29, Aradeonas wrote:


Use another memory manager (?)

Can you explain more or give an example?


The memory manager decides about how to allocate and release memory 
from/back to system.


https://www.google.at/search?q=fpc+memory+manager
http://www.freepascal.org/docs-html/3.0.0/prog/progsu176.html

But I am not an expert in this topic. I was always happy with the 
default FPC memory manager and FastMM in Delphi.


Ondrej
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus