Question regarding libsmbclient.

Richard Sharpe sharpe at ns.aus.com
Sun May 27 11:35:47 GMT 2001


At 03:05 AM 5/27/01 -0700, Ray Van Dolson wrote:
>I'm just wondering how many are developing out there using
>libsmbclient.so.  I'm trying to write a sort of samba spider that indexes
>my local Samba network and dumps the results into MySQL.  I'm using a
>recursive approach and am running into huge resource problems.
>
>The source code for my program is located at
>
>	http://www.bludgeon.org/~rayvd/samba/

OK, I will look some time this week ...

>This should compile for anyone as I have commented out the MySQL portions
>of the code.  The program runs for a while, and as I monitor it with 'top'
>I notice that the memory usage gets huge as the recursion level gets
>larger.  I make liberal use of free() to keep as much cleaned up as I can,
>but eventually the program is either auto-killed by my kernel or I hvae to
>kill it myself else the system stops responding.

Hmmm ...

>I'm wondering if the fault is due to my shoddy C programming skills
>(someone already has suggested I try jCIFS which I will) or a memory leak
>or inefficiency in libsmbclient.so.  If someone a little more experienced
>than I could discern this from glancing at my code, I'd sure appreciate
>it.

OK, I doubt that it is you programming skills. The problem may be that in
libsmbclient, when you open a directory, I slurp up all the entries in the
directory into malloc'd structures ...

This is forced on my because I re-used a lower layer libsmb routine that
expected to read the whole directory in one go and calls a call-back ...

Perhaps I need to defer reading the directory until smbc_getdents is
called. I was wondering when this would bite, and perhaps it is now ...

>Ray Van Dolson


Regards
-------
Richard Sharpe, sharpe at ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.ethereal.com)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba






More information about the samba-technical mailing list