<p dir="auto">by <strong>claudiu.garba</strong>:</p>
<pre class="notranslate">When trying to parse a huge csv file(450MB) the memory increase at 1.2GB, with a spike
at 1.6GB. The amount of time to finish the program is ~ 1,30 minutes.
OS: mac osx
go version :1.2, 64biti
code here: <a href="http://play.golang.org/p/jrVSqCcMpQ" rel="nofollow">http://play.golang.org/p/jrVSqCcMpQ</a>

The csv file has 450MB and ~ 1 milion rows. The code just print in terminal the current
row.
The csv has some errors inside, like missing comma, or spaces. 
When I run the program, it stops for 10 seconds and then the memory increase from 600MB
to 1.6GB then, remain at 1.2GB.</pre>
<p dir="auto">Attachments:</p>
<ol dir="auto">
<li><a href="https://storage.googleapis.com/go-attachment/8059/0/small.txt" rel="nofollow">small.txt</a> (2993 bytes)</li>
</ol>
<pre class="notranslate">I'm attempting to wrap libusb so I can interface with my kinect.  I have basic control
working and have written the bulk and interrupt code, but isochronous requires using the
asynchronous API, which cgo seems to be having trouble with.

Consider the following code:

/* iso.go */
package usb

// #include &lt;libusb-1.0/libusb.h&gt;
import "C"

type Transfer C.struct_libusb_transfer
/* end */

The struct is documented here:
<a href="http://libusb.sourceforge.net/api-1.0/structlibusb__transfer.html" rel="nofollow">http://libusb.sourceforge.net/api-1.0/structlibusb__transfer.html</a>

and defined here (see line 765):
<a href="http://libusb.sourceforge.net/api-1.0/libusb_8h_source.html" rel="nofollow">http://libusb.sourceforge.net/api-1.0/libusb_8h_source.html</a>

notably:
{...
struct libusb_iso_packet_descriptor iso_packet_desc[0];
...}

and cgo reports:
iso.go:7:15: struct size calculation error off=72 bytesize=64

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM
build 2335.15.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ go version
go version go1

$ go env
GOROOT="/opt/go"
GOBIN=""
GOARCH="amd64"
GOCHAR="6"
GOOS="darwin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOTOOLDIR="/opt/go/pkg/tool/darwin_amd64"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-common"
CGO_ENABLED="1"</pre>