Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User gotzingerdan's Avatar
    Join Date
    Mar 2005
    Location
    Bucharest, Romania
    Posts
    10
    I am trying to compile a Python PYD library, but I keep getting "undefined reference to 'symport_malloc' and 'symport_free'".

    Can't find any mention of it in the reference materials.

    Does anyone have an idea, which library this can be linked with?

    Thanks in advance,

    Dan

  2. #2
    Super Contributor jplauril's Avatar
    Join Date
    Dec 2004
    Posts
    643
    Originally posted by gotzingerdan
    I am trying to compile a Python PYD library, but I keep getting "undefined reference to 'symport_malloc' and 'symport_free'".

    Can't find any mention of it in the reference materials.

    Does anyone have an idea, which library this can be linked with?

    Thanks in advance,

    Dan
    You probably use the macro versions of memory management functions in your extension (PyObject_NEW, PyMem_MALLOC etc.). These macros are not supported in Python for Series 60 release 1.0. Use the equivalent functions (PyObject_New, PyMem_Malloc etc.) instead.

    The macro versions try to invoke the internal memory management functions (symport_malloc etc.) directly, which doesn't work since the Python DLL doesn't export those functions. Yes, this can be considered a bug in the Python release.

  3. #3
    Registered User gotzingerdan's Avatar
    Join Date
    Mar 2005
    Location
    Bucharest, Romania
    Posts
    10
    Thanks a lot, the problem was in fact with PyObject_NEW and PyObject_DEL.

    Dan

  4. #4
    Registered User akonan's Avatar
    Join Date
    May 2003
    Posts
    5
    Quote Originally Posted by jplauril
    You probably use the macro versions of memory management functions in your extension (PyObject_NEW, PyMem_MALLOC etc.). These macros are not supported in Python for Series 60 release 1.0. Use the equivalent functions (PyObject_New, PyMem_Malloc etc.) instead.

    The macro versions try to invoke the internal memory management functions (symport_malloc etc.) directly, which doesn't work since the Python DLL doesn't export those functions. Yes, this can be considered a bug in the Python release.
    Could you show a simple example of PyMem_MALLOC? I couldn't get it working.

  5. #5
    Registered User akonan's Avatar
    Join Date
    May 2003
    Posts
    5
    Addition: Right question to as might be: What library does PyMem_MALLOC use?

  6. #6
    Super Contributor jplauril's Avatar
    Join Date
    Dec 2004
    Posts
    643
    PyMem_MALLOC tries to use internal functions of PYTHON222.DLL, and that doesn't work since the functions are unexported. Use PyMem_Malloc instead.

  7. #7
    Registered User akonan's Avatar
    Join Date
    May 2003
    Posts
    5
    Quote Originally Posted by jplauril
    PyMem_MALLOC tries to use internal functions of PYTHON222.DLL, and that doesn't work since the functions are unexported. Use PyMem_Malloc instead.
    Still I get this: "NameError: name ' PyMem_Malloc' is not defined" error. I'm completely newbie here so I'll tell what I've been doing

    I'm trying to reserve certain percentage of free RAM - this could be done using PyMem_Malloc? And it should work without importing anything? Now I've just been trying to use it from interactive console without success.

  8. #8
    Super Contributor jplauril's Avatar
    Join Date
    Dec 2004
    Posts
    643
    All the functions we discussed here are C functions. You can't call them directly from Python scripts.

    Why would you want to reserve memory?

  9. #9
    Registered User akonan's Avatar
    Join Date
    May 2003
    Posts
    5
    Ok, that explains it Thanks!

    I've created a memory monitor for testing purposes and I thought that it would be great to add a feature that would fill up the memory. This way I could test applications when system is running low on memory.

  10. #10
    Super Contributor jplauril's Avatar
    Join Date
    Dec 2004
    Posts
    643
    Well, just create a large string: one_megabyte_string='x'*1000000

  11. #11
    Registered User akonan's Avatar
    Join Date
    May 2003
    Posts
    5
    Thanks! A bit too obvious *blush*

  12. #12
    Registered User gekac++'s Avatar
    Join Date
    Sep 2005
    Posts
    5
    How I can read RAM memory?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved