I would like to have the following
allocate(1617191936);
Program received signal SIGSEGV, Segmentation fault. 0x08092695 in low_allocate_array (size=1617191936, extra_space=0) at /home/nilsson/Pike/7.7/src/array.c:118 118 ITEM(v)[e].u.integer=0;
generate an out of memory message instead (if indeed that is the problem). But the malloc call do returns a pointer, so I don't know what is wrong.
This looks like the multiplication overflow problem again. Your element count multiplied by the size of an svalue (8) can not be represented in 32 bits, thus the argument to malloc will be too small due to truncation.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-08-18 13:44: Subject: out of memory in allocate
I would like to have the following
allocate(1617191936);
Program received signal SIGSEGV, Segmentation fault. 0x08092695 in low_allocate_array (size=1617191936, extra_space=0) at /home/nilsson/Pike/7.7/src/array.c:118 118 ITEM(v)[e].u.integer=0;
generate an out of memory message instead (if indeed that is the problem). But the malloc call do returns a pointer, so I don't know what is wrong.
/ Martin Nilsson (DivX Networks)
I better leave that problem for someone else to fix.
/ Martin Nilsson (DivX Networks)
Previous text:
2004-08-18 13:53: Subject: out of memory in allocate
This looks like the multiplication overflow problem again. Your element count multiplied by the size of an svalue (8) can not be represented in 32 bits, thus the argument to malloc will be too small due to truncation.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
if( size > ULONG_MAX/8 ) /* is there a SIZE_T_MAX? */ Pike_error("Too large array (memory size exceeds size of size_t)\n");
There is probably similar errors in the string functions and quite a lot of other functions too.
We really should do a code review and check for it. I fixed all occurances I found in the fileencodings in the image module.
/ Per Hedbor ()
Previous text:
2004-08-18 14:00: Subject: out of memory in allocate
I better leave that problem for someone else to fix.
/ Martin Nilsson (DivX Networks)
Sounds like a good idea. Coordinated event?
/ Martin Nilsson (DivX Networks)
Previous text:
2004-08-18 14:21: Subject: out of memory in allocate
if( size > ULONG_MAX/8 ) /* is there a SIZE_T_MAX? */ Pike_error("Too large array (memory size exceeds size of size_t)\n");
There is probably similar errors in the string functions and quite a lot of other functions too.
We really should do a code review and check for it. I fixed all occurances I found in the fileencodings in the image module.
/ Per Hedbor ()
Can we make it an interactive one? I don't think I'll have the time to go to Linköping anytime soon. At least not for just one day.
(But perhaps Peter can lend me his sofa again..?)
/ Marcus Agehall (PacketFront)
Previous text:
2004-08-18 15:21: Subject: out of memory in allocate
A bug hunting day sounds like a good start.
/ Peter Bortas
I can lend you a couch as well, though this week it's occupated by Fred van Dijk. :-)
/ Johan Sundström (Achtung Liebe!)
Previous text:
2004-08-18 15:29: Subject: out of memory in allocate
Can we make it an interactive one? I don't think I'll have the time to go to Linköping anytime soon. At least not for just one day.
(But perhaps Peter can lend me his sofa again..?)
/ Marcus Agehall (PacketFront)
Sounds good. I'll be going to Linköping sometime early september I believe. I need to buy my projector as soon as it is released...
/ Marcus Agehall (PacketFront)
Previous text:
2004-08-18 15:50: Subject: out of memory in allocate
I can lend you a couch as well, though this week it's occupated by Fred van Dijk. :-)
/ Johan Sundström (Achtung Liebe!)
Sure.
/ Peter Bortas
Previous text:
2004-08-18 15:29: Subject: out of memory in allocate
Can we make it an interactive one? I don't think I'll have the time to go to Linköping anytime soon. At least not for just one day.
(But perhaps Peter can lend me his sofa again..?)
/ Marcus Agehall (PacketFront)
SIZE_MAX exists in the C99 standard. And if the compiler doesn't define it, it's simple enough to probe the value from the configure script and add it to machine.h.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-08-18 14:21: Subject: out of memory in allocate
if( size > ULONG_MAX/8 ) /* is there a SIZE_T_MAX? */ Pike_error("Too large array (memory size exceeds size of size_t)\n");
There is probably similar errors in the string functions and quite a lot of other functions too.
We really should do a code review and check for it. I fixed all occurances I found in the fileencodings in the image module.
/ Per Hedbor ()
8?
/ Mirar
Previous text:
2004-08-18 14:21: Subject: out of memory in allocate
if( size > ULONG_MAX/8 ) /* is there a SIZE_T_MAX? */ Pike_error("Too large array (memory size exceeds size of size_t)\n");
There is probably similar errors in the string functions and quite a lot of other functions too.
We really should do a code review and check for it. I fixed all occurances I found in the fileencodings in the image module.
/ Per Hedbor ()
Btw, 12? If you use 64 bit ints/floats, shouldn't you need 64 bit alignment, giving them a padded size of 16 bytes?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-08-19 09:55: Subject: out of memory in allocate
Doesn't seem to be very optimal, all my Pike's have a sizeof(struct svalue) of 12... :)
/ Mirar
That is possible. However, when compiling with --with-long-long-int and --with-double-precision, sizeof(struct svalue) becomes 12.
Does >32 bit alignment matter much for a P4 though?
/ Mirar
Previous text:
2004-08-19 09:56: Subject: out of memory in allocate
Btw, 12? If you use 64 bit ints/floats, shouldn't you need 64 bit alignment, giving them a padded size of 16 bytes?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
I don't know. On 68030, unaligned accesses were slower than aligned ones. I would expect the same to hold for other CISC architectures. At least doubles are loaded with a single instruction, so just 32 bit alignment does not make it an aligned load. For long long it might not matter if it is handled as two 32 bit values anyway.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-08-19 09:58: Subject: out of memory in allocate
That is possible. However, when compiling with --with-long-long-int and --with-double-precision, sizeof(struct svalue) becomes 12.
Does >32 bit alignment matter much for a P4 though?
/ Mirar
Sounds like a typical error, where X*sizeof(svalue) is small if capped in whatever malloc takes as argument.
/ Mirar
Previous text:
2004-08-18 13:44: Subject: out of memory in allocate
I would like to have the following
allocate(1617191936);
Program received signal SIGSEGV, Segmentation fault. 0x08092695 in low_allocate_array (size=1617191936, extra_space=0) at /home/nilsson/Pike/7.7/src/array.c:118 118 ITEM(v)[e].u.integer=0;
generate an out of memory message instead (if indeed that is the problem). But the malloc call do returns a pointer, so I don't know what is wrong.
/ Martin Nilsson (DivX Networks)
pike-devel@lists.lysator.liu.se