Forum > Linux

[Solved] 1.8 Memory Issue - I Think

(1/2) > >>

Hover:
Hi, I have been away from Lazarus for several months, so I installed the latest 1.8 version using the deb packages on Sourceforge. I wiped everything Lazarus and FPC from the machine first, then locked the package manager so that it would not try to overwrite the installation with Debian repository packages.

I then started a new project using SDL, which is new to me,  and immediately ran into memory issues, with the machine locking up repeatedly. After beating my head against the wall for several days, I determined that everything was eating memory, or at least seemed to be.

So I did a full Debian update, rebuilt the IDE, and rebooted to a clean XFce4 desktop and started a new empty project (graphical application). I did nothing with it except enable the heaptrc unit. 

When I built and ran the empty project then immediately clicked on the form's close button, heaptrc showed 767 memory blocks allocated and freed. But when I dragged the empty form around rapidly for a few seconds, I got ghost trails and a heaptrc reading in the thousands of memory blocks allocated and freed.

I am not a professional programmer, far from it, but this seems very wrong to me. Any advice or insights would be very welcome.

Thanks,
Hover

taazz:

--- Quote from: Hover on January 23, 2018, 02:57:43 am ---Hi, I have been away from Lazarus for several months, so I installed the latest 1.8 version using the deb packages on Sourceforge. I wiped everything Lazarus and FPC from the machine first, then locked the package manager so that it would not try to overwrite the installation with Debian repository packages.

I then started a new project using SDL, which is new to me,  and immediately ran into memory issues, with the machine locking up repeatedly. After beating my head against the wall for several days, I determined that everything was eating memory, or at least seemed to be.

So I did a full Debian update, rebuilt the IDE, and rebooted to a clean XFce4 desktop and started a new empty project (graphical application). I did nothing with it except enable the heaptrc unit. 

When I built and ran the empty project then immediately clicked on the form's close button, heaptrc showed 767 memory blocks allocated and freed. But when I dragged the empty form around rapidly for a few seconds, I got ghost trails and a heaptrc reading in the thousands of memory blocks allocated and freed.

--- End quote ---
that's how things work memory block are allocated when needed and free when they are not needed any longer as long as the total is 0 then you have leaks elsewhere.

avra:

--- Quote from: Hover on January 23, 2018, 02:57:43 am ---I determined that everything was eating memory, or at least seemed to be.
--- End quote ---
Memory leaking or more memory spent then you would expect? How did you come to this conclusion? Show us heaptrc output on application exit. Does this happen on every example project from your Lazarus installation, or just with SDL2? What do you use for SDL2?

Hover:
Well, it was definitely leaking since the entire machine locked up.   :o

The good news is I traced the major culprit to the guy writing the program.  :-[   I forgot to destroy an SDL texture when it failed to load an image properly. The following load would generate a new texture using more memory.

The images come from an external source. Probably 2-3% or so are corrupt and fail to load. Currently, the application is loading five images a second, so it didn't take all that long to eat up the memory.

I also noticed that manual form movement increased project memory requirements, hence my original post. I don't really understand the internals of the Lazarus environment. It doesn't really matter though since it only happens in the IDE and has no impact on the final standalone program.

Thanks for the comments folks.

Edit: I am using these SDL2 headers. https://github.com/ev1313/Pascal-SDL-2-Headers

avra:

--- Quote from: Hover on January 23, 2018, 05:12:35 pm ---Well, it was definitely leaking since the entire machine locked up.
--- End quote ---
Your issue explanation was and still is misleading, since it sounded like your Lazarus 1.8 is leaking. I apologize if I interpreted it wrongly, but that was the impression I got. The whole point of my questions was to show you that you should first look for the issue source in your application and not in Lazarus, and if it was Lazarus then either included examples or minimal project showing the reproducible issue are needed for a bug report. Thankfully this was not a Lazarus issue.

Anyway, I am glad your problem is solved...

Navigation

[0] Message Index

[#] Next page

Go to full version