×

Discussion Board

Results 1 to 12 of 12

Hybrid View

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Bucharest, Romania
    Posts
    10

    Angry What library does symport_malloc use?

    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
    Join Date
    Dec 2004
    Posts
    643

    Re: What library does symport_malloc use?

    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
    Join Date
    May 2003
    Posts
    5

    Re: What library does symport_malloc use?

    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.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    Bucharest, Romania
    Posts
    10

    Re: Re: What library does symport_malloc use?

    Thanks a lot, the problem was in fact with PyObject_NEW and PyObject_DEL.

    Dan

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    5

    Re: What library does symport_malloc use?

    Addition: Right question to as might be: What library does PyMem_MALLOC use?

  6. #6
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: What library does symport_malloc use?

    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
    Join Date
    May 2003
    Posts
    5

    Re: What library does symport_malloc use?

    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
    Join Date
    Dec 2004
    Posts
    643

    Re: What library does symport_malloc use?

    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
    Join Date
    May 2003
    Posts
    5

    Re: What library does symport_malloc use?

    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
    Join Date
    Dec 2004
    Posts
    643

    Re: What library does symport_malloc use?

    Well, just create a large string: one_megabyte_string='x'*1000000

  11. #11
    Registered User
    Join Date
    May 2003
    Posts
    5

    Re: What library does symport_malloc use?

    Thanks! A bit too obvious *blush*

  12. #12
    Registered User
    Join Date
    Sep 2005
    Posts
    5

    Re: What library does symport_malloc use?

    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
  •  
×