> On Aug 3, 2017, at 10:59 , Chris Ridd <chrisr...@mac.com> wrote: > > I had a requirement to extract 30+ million entries from an ldap server, and > naively thought that using callbacks would be useful. > > While they are useful in getting me each result quickly, I didn't realise > that Search still captures each result in self. So after reading several > million entries Linux's oom killer kindly killed a) the ldap server and then > b) my script to try and get back some memory! > > I ended up patching Search.pm to avoid capturing each result when using > callbacks. Is there a better way to do this?
Did you call $mesg->pop_entry; in you callback. See http://search.cpan.org/~marschap/perl-ldap-0.65/lib/Net/LDAP/FAQ.pod#USING_THE_CALLBACK_SUBROUTINE_APPROACH <http://search.cpan.org/~marschap/perl-ldap-0.65/lib/Net/LDAP/FAQ.pod#USING_THE_CALLBACK_SUBROUTINE_APPROACH> for an example Graham.