Csound Csound-dev Csound-tekno Search About

[Cs-dev] memory allocation bug in sread.c

Date2005-06-16 23:18
Fromserge lemouton
Subject[Cs-dev] memory allocation bug in sread.c
Hello,

I think that I have found a memory allocation related bug.
It happens when reading score with quite long lines and when csound 
need to reallocate some memory space with mcalloc().
I dont really understand how this dynamic memory management is supposed 
to work, can somebody explain ?
This crash doesn't happen if I change the  block size : MEMSIZ  from  
10000L to, say, 100000L ...

Serge

------------

Here is a gdb trace :

(gdb) set args pl-2.orc pl-2.sco
(gdb) run
Starting program: 
/Users/lemouton/Projets/Csound/csound-4.23f12gbs.9/csound/csound 
pl-2.orc pl-2.sco
Reading symbols for shared libraries ....... done
Using 
/Users/lemouton/Projets/Csound/csound-4.23f12gbs.9/csound/csound.xmg
0dBFS level = 32767.0
Csound Version 4.23f12 (Mar  9 2005)
orchname:  pl-2.orc
scorename: pl-2.sco
Changing 0x539000(25040) to 0x539000(34800)
orch compiler:
61 lines read
Changing 0x11020d0(16) to 0x11020e0(20)
Changing 0x11022b0(16) to 0x11022c0(20)
Changing 0x1102390(16) to 0x11023a0(20)
sorting score ...
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
sread: requesting more memory
Changing 0x182b200(10000) to 0x182b200(10200)
sread: requesting more memory
Changing 0x182da00(10000) to 0x182da00(10200)
sread: requesting more memory
Changing 0x1830200(10000) to 0x1830200(10200)
Changing 0x1830200(10200) to 0x1832a00(10400)

Program received signal EXC_BAD_ACCESS, Could not access memory.
getpfld () at sread.c:1578
1578                if (pp->prvblk) pp->prvblk = 
(SRTBLK*)(((char*)pp->prvblk)+change);



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-06-17 11:21
FromIstvan Varga
SubjectRe: [Cs-dev] memory allocation bug in sread.c
serge lemouton wrote:
> Hello,
> 
> I think that I have found a memory allocation related bug.
> It happens when reading score with quite long lines and when csound need 
> to reallocate some memory space with mcalloc().
> I dont really understand how this dynamic memory management is supposed 
> to work, can somebody explain ?
> This crash doesn't happen if I change the  block size : MEMSIZ  from  
> 10000L to, say, 100000L ...

I assume this is Csound 4. Try Csound 5, it should have fixed this problem.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net