mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
When alloc size is too large, only allocate struct
This commit is contained in:
parent
31e24a42f3
commit
6fe46ff967
Notes:
git
2023-06-12 14:20:25 +00:00
2 changed files with 9 additions and 1 deletions
2
struct.c
2
struct.c
|
@ -849,7 +849,7 @@ struct_alloc(VALUE klass)
|
|||
return (VALUE)st;
|
||||
}
|
||||
else {
|
||||
NEWOBJ_OF(st, struct RStruct, klass, flags, embedded_size, 0);
|
||||
NEWOBJ_OF(st, struct RStruct, klass, flags, sizeof(struct RStruct), 0);
|
||||
|
||||
st->as.heap.ptr = struct_heap_alloc((VALUE)st, n);
|
||||
rb_mem_clear((VALUE *)st->as.heap.ptr, n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue