I'm something of a Cell novice and noticed something weird today. My SPU executable grew huge (from about 24K to over 300K file size) and effectively sucked up all the local store at the expense of my data buffers. After some investigation, I determined that the culprit was a simple wrapper class I had written for mfc_list_element_t. Adding a default constructor to said class proved disastrous.
Now, I have constructors for all sorts of classes so I couldn't figure out what made this one special. I think the difference is that I declared a fixed-sized array of these statically before main() instead of just one scalar instance. I didn't even need to use the variable to see the code grow. I tried disassembling it and found all sorts of extra garbage linked in. malloc was in there, for example, even though I don't use that anywhere.
Anyway, removing the constructor solved the problem. Just thought I'd share this in case anyone else runs into it.
Pinned topic Ballooning code size with spuxlc++ constructors
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-08-17T14:56:36Z at 2010-08-17T14:56:36Z by einervondenen
ekchew 2700032S3F6 Posts
Re: Ballooning code size with spuxlc++ constructors2010-08-16T17:03:00ZThis is the accepted answer. This is the accepted answer.
- jadamcze 060000NGAR
einervondenen 270002SNCF8 Posts
Re: Ballooning code size with spuxlc++ constructors2010-08-17T14:56:36ZThis is the accepted answer. This is the accepted answer.I've seen similar behavior when using "new" in SPE code (compiling with spu-gcc though).
Did your default constructor do anything/contained any code? If yes can we see it?
What made the problem go away? Removing the constructor or removing the fixed-size array of the objects?