Recent

Author Topic: FPC-USB-HID  (Read 14308 times)

JohnSmith

  • New Member
  • *
  • Posts: 21
FPC-USB-HID
« on: April 05, 2017, 06:49:09 am »
Hi all

I have download FPC-USB-HID and compile a demo app for windows. I let it run for 24 hours and see that the memory is stable, however if i compile it to run on a raspberry pi ( the same demo app) the memory grows. Looks like there is a memory leak.

Does anyone have the same issue ? Is there a different HID Lib that can be used ?

Thanks

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: FPC-USB-HID
« Reply #1 on: April 05, 2017, 08:35:26 am »
The lib has been tested very well on RPi, and should not cause any memory leaks.
Please use the heaptrc-option (or -gh) in Lazarus to check for leaks.

Other libs:
https://github.com/prof7bit/HIDAPI.pas
https://github.com/hansiglaser/pas-libusb

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: FPC-USB-HID
« Reply #2 on: April 05, 2017, 08:55:51 am »
Do you have something else running 24X7? Because, like DonAlfredo wrote as well, I use that code and can't replicate it.
Are you sure, absolutely definitely sure that nothing else causes it?

And yes, try -gh or better -glh (includes the line number that causes possible grief)

For good measure: which version of FPC are you using?
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #3 on: April 05, 2017, 12:07:37 pm »
Hi DonAlfredo,

I use htop, and it also show that the memory goes up. heaptrc-option report nothing , no leaks , but it does not explain why the memory goes up.  I tested the app last night with the starting memory of 27mb and at 06:18 the memory was standing on 34mb.

If i use the same app and compile it for windows the memory does not increase at all. I download a program Solarpiplog for Raspberry pi develope by someone else and after 24 hours the app memory stays the same on the pi

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: FPC-USB-HID
« Reply #4 on: April 05, 2017, 01:56:21 pm »
@JohnSmith
Let the program run longer and see what happens.

I have a RPi running now for 34 weeks 24/7 (no restart) with this lib without problems.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: FPC-USB-HID
« Reply #5 on: April 05, 2017, 02:46:30 pm »
About the same here....? Can you give us some more info?
I have lot's of Pi's to test, but as it stands your issue is not reproducible (you changed the code of the example? Not at all?)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #6 on: April 05, 2017, 04:30:53 pm »
Thanks for all the feedback.

What do you need from me, Access to the Pi to see or uploading of the code. I have run the program before for a week and the memory was about 200mb. I am using Lazarus 1.6.

I believe it is a program (sample ) that DonAlfredo did for someone ? I got the sample from a forum called powerforum. Its said that there is a memory leak , so i have tested it and now reporting it here

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: FPC-USB-HID
« Reply #7 on: April 05, 2017, 04:35:54 pm »
That is good info !

Did you get the latest library from GitHub ?
https://github.com/LongDirtyAnimAlf/FPC-USB-HID

Because you are right: there were mem-problems, but they should be solved !!

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #8 on: April 05, 2017, 04:47:47 pm »
Yes I believe it is the latest. Do you want me to Upload it somewhere to be checked out ?

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: FPC-USB-HID
« Reply #9 on: April 05, 2017, 04:53:44 pm »
Yes please.

You can also PM me with a link, if you do not want it to be open.
But it would be nice if other can benefit also.

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #10 on: April 05, 2017, 05:18:07 pm »
Thanks, I will post the address here.

http://www.mediafire.com/file/o0gow35cscu7zx8/NewUSBTest+wirh+memory+feed.rar

I have started the test again
Htop results
Virt
43032  32064 18640
 after 30 min
48966 24712 20064

Task manager
22.5mb
now 24.1

Start
USB Test
Heap  611 KB
VmSize 43076 KB
Pss 3200

Now
Heap 611 KB
VmSize 48740 KB
Pss 3200

Hope it helps

Thank you DonAlfredo !

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #11 on: April 05, 2017, 05:34:03 pm »
Is it possible to connect to 2 devices with the same Vendor and Product and retrieve info from it

Thanks

john horst

  • Jr. Member
  • **
  • Posts: 68
    • JHorst
Re: FPC-USB-HID
« Reply #12 on: April 05, 2017, 10:47:44 pm »
Maybe try ...

  {$IFDEF UNIX}
  cthreads,
  cmem,
  {$ENDIF}

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #13 on: April 06, 2017, 11:55:26 am »
Just some feedback

Heap 611 KB
VmSize 49412 KB
Pss 3200

Task manager
25.0mb

JohnSmith

  • New Member
  • *
  • Posts: 21
Re: FPC-USB-HID
« Reply #14 on: April 07, 2017, 02:04:49 pm »
Could you see anything wrong with the source code?

How do I donate to this project ?

Thanks

 

TinyPortal © 2005-2018