Topic
  • 3 replies
  • Latest Post - ‏2010-08-17T14:56:36Z by einervondenen
ekchew
ekchew
6 Posts

Pinned topic Ballooning code size with spuxlc++ constructors

‏2010-08-13T21:01:03Z |
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.

-Ted
Updated on 2010-08-17T14:56:36Z at 2010-08-17T14:56:36Z by einervondenen
  • jadamcze
    jadamcze
    219 Posts

    Re: Ballooning code size with spuxlc++ constructors

    ‏2010-08-14T05:23:53Z  
    Do you compile with any kind of optimisation?
  • ekchew
    ekchew
    6 Posts

    Re: Ballooning code size with spuxlc++ constructors

    ‏2010-08-16T17:03:00Z  
    • jadamcze
    • ‏2010-08-14T05:23:53Z
    Do you compile with any kind of optimisation?
    It doesn't seem to matter whether I use optimization or not. I have an optimized build and a debug build without optimization and they are both similarly affected.
  • einervondenen
    einervondenen
    8 Posts

    Re: Ballooning code size with spuxlc++ constructors

    ‏2010-08-17T14:56:36Z  
    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?