Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Lil
Hi Everyone! I've been trying to figure out this weird bug in my
program. I have a python program that calls a C function that reads in
a binary file into a buffer. In the C program, buffer is allocated by
calling malloc. The C program runs perfectly fine but when I use python
to call the C function, it core dumps at malloc.
I've tried multiple binary files with different sizes and the result
is:

if file size is < 20 bytes , works fine
if file size is > 20 bytes, it hangs or core dumps.

Please help!! 
Lil

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Lil
Hi Larry,
  It's in the C code mainly because the buffer is an input to the
driver. The driver takes a char* as input and I didn't want to pass a
char* from python -> swig -> C since swig has memory leaks passing
pointers.
Do you think this is a Python issue or a Red Hat issue? I'm going to
try it on my windows machine now and see what happens.

thanks! Lil

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Lil
I already double checked my C code. It runs perfectly fine in C without
any errors. So in my python program, I added a pdb.set_trace()
and step through the program and it did not dump. But when i took out
the tracing, the core dump came back. "sigh"

-- 
http://mail.python.org/mailman/listinfo/python-list