From: Tormod V. <lis...@gm...> - 2012-10-02 12:01:38
|
On Tue, Oct 2, 2012 at 1:14 PM, Christoph Sander wrote: > Hi, > > I guess the code will say more then thousand words, so: > > long ctx; > Usb_Device device; > ctx = LibusbJava1.libusb_init(); > for (int k = 0; k < 1000000; k++) > { > System.out.println(" ********************************** " + k); > device = LibusbJava1.libusb_get_device_list((Long) ctx); > } > > > Thats all i do, and after 1300 calls of the libusb_get_device_list(ctx) command, the Java runtime collapses. Does anyone got this problem with the libusb, or does it have to be a problem with the Java wrapper? Hi Chris, Did you see the libusb_get_device_list() documentation on http://libusb.sourceforge.net/api-1.0/group__dev.html ? "You are expected to unreference all the devices when you are done with them, and then free the list with libusb_free_device_list()." So in your case you are allocating lots of lists without freeing them. I am bit surprised you get trouble already after 1300 calls, but I don't know what overhead Java adds to it. Best regards, Tormod |