memory position of numpy arrays

Lars Friedrich lfriedri at
Mon Oct 23 01:25:11 CDT 2006

Hello all,

to interact with some hardware (data retrieval), I use the following
scheme (Windows, Python 2.4):

* in Python, I create a numpy array as a buffer
* I pass this array to a self written .dll using ctypes
* the C-code in the .dll passes the pointer to the buffer to the API of
the hardware; then the API starts writing data to my buffer
* from python I can use a helper function of the .dll to know which part
of the buffer is safe to be read at the moment; so I can copy this part
to a different numpy array and work with the data

This works quite well, but today I got a blue screen, reporting some
paging-problem. It occured after doing some other stuff like moving some
windows on the screen and importing pylab, and I heard the harddisk
working hard, so I assume that the part of memory my buffer is in, was
paged to the harddisk. This is a problem, since the hardware driver will
continuously try to write to this specific memory location I gave to it.

My primary question is, how to avoid a numpy-array being paged. In the
ideal case there would be a flag to set, that makes sure that this array
is always at this position in physical memory.

Of course I am also interested in other people's work on hardware
access. Do you think the above discribed way is a good one? To me it was
the best way because I could do as much as possible in Python and keep
may C-coded .dll very small. Is anyone doing similar things?

Thanks for every comment


Dipl.-Ing. Lars Friedrich
Optical Measurement Technology
Department of Microsystems Engineering -- IMTEK
University of Freiburg
Georges-Köhler-Allee 102
D-79110 Freiburg

phone: +49-761-203-7531
fax:   +49-761-203-7537
room:  01 088
email: lfriedri at

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Numpy-discussion mailing list
Numpy-discussion at

More information about the Numpy-discussion mailing list