×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2003
    Location
    Mumbai, India
    Posts
    25

    C Standard Library, String methods, Memory Leak?

    Hi,
    I wrote some code for the Series60 platform using the Symbian Standard
    C Library string routines. I used the sscanf(), strstr() and strtok()
    methods. When I run the GUI app, the main code runs absolutely fine; but it
    crashes with a ALLOC:0 XXXXXXXX Panic on the emulator when I exit the app.
    On the device (Nokia 3650), it exits without a hitch.
    While debugging, I commented out the calls to the C String routines.
    This got rid of the exit ALLOC panic on the emulator. When I uncommented the
    sscanf() call only, it crashed again on exit. I tried this with the other
    calls (strstr() & strtok()) too with the same results.
    One weird thing I found was that changing the Exit() command in my AppUi
    to an User::Exit() solved the problem! No crashes on the emulator or device.
    I don't get how this affects anything!! Could someone please tell me what
    could be occurring? Is the Standard Library code for the emulator at fault?
    Has anyone else noticed this behaviour before?

    Thanks in advance,
    Regards,
    Varun

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    Call CloseSTDLIB() before exiting. See the SDK documentation on the C standard library for more info.

    Lauri

  3. #3
    Registered User
    Join Date
    Sep 2003
    Location
    Mumbai, India
    Posts
    25
    Hi,

    Thanks a lot. That worked quite well but I still don't understand though how it could work by just changing the exit method to User::Exit() and how the same code without CloseSTDLIB() worked on the target device. Any clues about that?

    Regards,
    Varun

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×