callin' c from lua crashs while reallocating

Posted by mkind on Stack Overflow See other posts from Stack Overflow or by mkind
Published on 2010-05-25T10:47:21Z Indexed on 2010/06/13 13:32 UTC
Read the original article Hit count: 228

Filed under:
|
|

hi folks,

i got a crazy error within that for-loop

matr=realloc(matr, newmax*sizeof(matr*));

for (i=0; i<newmax; i++){
    matr[i]=realloc(matr[i], newmax*sizeof(int));
}

matr is a multi-dimension array: int **matr. i need to resize column and row. first line resizes column and the for-loop resizes every row. it worked fine in c. now im working on a library for lua and it crashs here. compilin' works fine as well. but calling from lua crashs with

lua: malloc.c:3552: mremap_chunk: Assertion `((size + offset) & (mp_.pagesize-1)) == 0' failed.

i have no damn idea since it's working fine using it in c.

© Stack Overflow or respective owner

Related posts about c

    Related posts about malloc