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.
This topic has been locked.
3 replies Latest Post - 2010-08-17T14:56:36Z by einervondenen
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
jadamcze 060000NGAR219 Posts
ekchew 2700032S3F6 Posts
einervondenen 270002SNCF8 PostsACCEPTED ANSWER
Re: Ballooning code size with spuxlc++ constructors2010-08-17T14:56:36Z in response to ekchewI'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?