Re: [PD-dev] iem_tab on amd64 WAS: Building extended on amd64

2009-10-13 Thread IOhannes m zmoelnig
Hans-Christoph Steiner wrote:
 sed -i 's!^\(Depends:.*\)!\1 , libfftw3-3, zlib1g (=
 1:1.2.3.3.dfsg-1), libogg0 (= 1.0rc3), liblame0 (= 3.97),
 libvorbis0a (= 1.2.0), libgsl0ldbl (= 1.9), libimlib2, libdv4,
 tk8.5 (= 8.5.0), libquicktime1 (= 2:1.0.0+debian), libgl1-mesa |
 libgl1, libsdl1.2debian (= 1.2.10-1), libjpeg62, libxxf86vm1,
 libvorbisfile3 (= 1.2.0), libglib2.0-0 (= 2.16.0), libjack0 (=
 0.116.1), libglu1-mesa | libglu1, libc6 (= 2.4), libxv1,
 freeglut3, libc6-i386 , tcl8.5 (= 8.5.0), libvorbisenc2 (=
 1.1.2), libflite1, libmpeg3-1 (= 1.5.4), libfreetype6 (= 2.3.5),
 libpng12-0 (= 1.2.13-4), libxext6, libtiff4, libbz2-1.0, libgcc1
 (= 1:4.1.1-21), libgl1-mesa-glx | libgl1, libstdc++6 (=
 4.1.1-21), libx11-6, libtheora0, libspeex1 (= 1.1.8) , libjack0
 (= 0.116.1), libasound2 ( 1.0.18), libc6 (= 2.4)!'
 /home/muranyia/Download/pure-data/packages/linux_make/build//DEBIAN/control

i guess nobody will forget the dependencies of the pdx package in a
while, after it had been quoted 5 times in a row.
sometimes you guys make it really hard to follow your conversation.

bmsdr
IOhannes




smime.p7s
Description: S/MIME Cryptographic Signature
___
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


[PD-dev] Memory reallocation problem

2009-10-13 Thread Isidro Gonzalez
Hi:
I am triying to allocate a n*n matrix of a type defined structure of data.
The pd external object example I'm sending attached is very simple: each time 
it receives any message except the clear message it increments a counter and 
reallocate a matrix of n*n members where n is the number stored in the counter 
(so, 1, 4, 9, 16 and so on). If it receives the clear message, it reset the 
counter to 1 and reallocate the matrix to 1x1.
The fact is that the object crashed when reallocating and I can't be able to 
know what am I doing wrong. I use the traditional realloc function.
Any help will be welcome.
Best 
Isi


  

dummy.c
Description: Binary data
___
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Memory reallocation problem

2009-10-13 Thread Justin Glenn Smith
Isidro Gonzalez wrote:
 Hi:
 I am triying to allocate a n*n matrix of a type defined structure of data.
 The pd external object example I'm sending attached is very simple: each time 
 it receives any message except the clear message it increments a counter 
 and reallocate a matrix of n*n members where n is the number stored in the 
 counter (so, 1, 4, 9, 16 and so on). If it receives the clear message, it 
 reset the counter to 1 and reallocate the matrix to 1x1.
 The fact is that the object crashed when reallocating and I can't be able to 
 know what am I doing wrong. I use the traditional realloc function.
 Any help will be welcome.

realloc does no initialization of data.

In the for loop in the dummy_alloc function you are calling realloc on
uninitialized pointers. The fact that this ever fails to crash is
because you are by chance getting NULL pointers from the realloc when
you increase the size of a.

You need to manually set the newly acquired bytes in a to be NULL before
you can safely call realloc with them as arguments.

___
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Memory reallocation problem

2009-10-13 Thread Isidro Gonzalez
Many thanks for your kind answer.
I´m surprised because the way I use to allocate memory is the most commonly 
used.
Wouldn´t initializing the pointers to NULL destroy all the contents of previous 
memory they hold, if any...? So, why to use realloc this way, then? I would 
use free and malloc, instead.
Your advice works fine but when I try to use the memory, the object makes PD to 
crash.
Any further ideas? 
Many thanks
Isi


--- On Tue, 10/13/09, Justin Glenn Smith noisesm...@gmail.com wrote:

 From: Justin Glenn Smith noisesm...@gmail.com
 Subject: Re: [PD-dev] Memory reallocation problem
 To: Isidro Gonzalez isidro_gon...@yahoo.com
 Cc: pd-dev@iem.at
 Date: Tuesday, October 13, 2009, 4:10 PM
 Isidro Gonzalez wrote:
  Hi:
  I am triying to allocate a n*n matrix of a type
 defined structure of data.
  The pd external object example I'm sending attached is
 very simple: each time it receives any message except the
 clear message it increments a counter and reallocate a
 matrix of n*n members where n is the number stored in the
 counter (so, 1, 4, 9, 16 and so on). If it receives the
 clear message, it reset the counter to 1 and reallocate
 the matrix to 1x1.
  The fact is that the object crashed when reallocating
 and I can't be able to know what am I doing wrong. I use the
 traditional realloc function.
  Any help will be welcome.
 
 realloc does no initialization of data.
 
 In the for loop in the dummy_alloc function you are calling
 realloc on
 uninitialized pointers. The fact that this ever fails to
 crash is
 because you are by chance getting NULL pointers from the
 realloc when
 you increase the size of a.
 
 You need to manually set the newly acquired bytes in a to
 be NULL before
 you can safely call realloc with them as arguments.
 


  

___
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Memory reallocation problem

2009-10-13 Thread Justin Glenn Smith
Isidro Gonzalez wrote:
 Many thanks for your kind answer.
 I´m surprised because the way I use to allocate memory is the most commonly 
 used.
 Wouldn´t initializing the pointers to NULL destroy all the contents of 
 previous memory they hold, if any...? So, why to use realloc this way, 
 then? I would use free and malloc, instead.
 Your advice works fine but when I try to use the memory, the object makes PD 
 to crash.
 Any further ideas? 

The issue is that you need to initialize the data that realloc gives
you, but not touch the data you already had.

Using realloc is common enough, but you cannot count on the value of the
memory returned by realloc, it will be NULL much of the time, but can
also have random data in it. If you pass a NULL pointer to a call to
realloc you get a fresh patch of memory, if you send a random
uninitialized pointer that did not happen to be NULL, that is where you
are getting your segmentation violation.

This should be simple enough to fix if you use an extra variable to
store the previous dimensions of a, and then initialize your loop
variables accordingly.

I also recommend using the pd library functions getbytes and
resizebytes, which work like malloc and realloc except you need to track
the size of objects they return yourself, and I believe they are
designed to prevent hiccups in audio when used realtime.

___
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev