Re: [Vala] trying to allocate 4294967295 bytes



I would guess, it's because you're assigning a weak reference (returned
by data_get) to a strong one. When doing so, vala will make a copy of
the object referred by the weak ref, which in this case means to copy an
array of unknown length. Vala assigns -1 to data_length1 (to mean
"undefined"), but unfortunately that causes an array of length
4294967295 to be allocated...

You can probably solve the problem by using
        weak uchar[] data;
instead of 
        uchar data;
in your code.

regards
alberto

On Wed, 2009-05-20 at 17:44 +0200, Sebastian Spaeth wrote:
I have created this evas.vapi function:

        [CCode (array_length = false)]
        [NoArrayLength]
        public weak uchar[] data_get( bool for_writing );

(it is supposed to return a void* pointer which is still owned by the class)
which translates into:

      data = (_tmp4_ = (_tmp3_ = evas_object_image_data_get
(self->priv->barchart, TRUE), (_tmp3_ == NULL) ? ((gpointer) _tmp3_) :
_vala_array_dup2 (_tmp3_, -1)), data_length1 = -1, data_size =
data_length1, _tmp4_);

which fails as:

GLib-ERROR **: /build/buildd/glib2.0-2.20.1/glib/gmem.c:136: failed to
allocate 4294967295 bytes
aborting...

Any clues as to what I am doing wrong?

The C function definition is:
void *evas_object_image_data_get(const Evas_Object *obj, Eina_Bool
for_writing)

spaetz
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

This email has been scanned for all viruses by the MessageLabs Email
Security System.
-- 
Alberto Colombo, MSc

PhD student at Digital Imaging Research Centre
Kingston University, London

e-mail: a colombo kingston ac uk
 phone: +44 (0)20 8547 8642
  http://cism.kingston.ac.uk/people/details.php?AuthorID=925

This email has been scanned for all viruses by the MessageLabs Email
Security System.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]