itkDB dbGetCellViewViewName

Discussion in 'Cadence' started by Ike Naar, Feb 24, 2009.

  1. Ike Naar

    Ike Naar Guest

    Hopefully someone can help me with this.
    I'm using the itkDB C interface functions to access a CDBA database.
    Some of the "get" functions return a C string (pointer to char), e.g.

    extern String dbGetCellViewViewName(dbCellViewId);

    dbCellViewId id = /* assume a meaningful value */;
    char * viewname = dbGetCellViewViewName(id);

    The question is: who owns the memory that is returned by the function
    (here, the string ``viewname'') ?
    Is it owned by the database? By the caller?
    Is it safe to modify the string?
    Is it necessary to free the string after having finished with it?

    Kind regards,
    Ike Naar, Feb 24, 2009
    1. Advertisements

  2. Ike Naar wrote, on 02/24/09 22:52:

    Strings returned by these functions are what we call "PermStrings". Without
    going into the details of the implementation, the memory is managed by the
    Cadence code, and you must NOT modify the value nor free the memory afterwards.

    The memory is "permanently" allocated, but this is done in a smart way to avoid
    a continual leakage of memory when you have repeated calls.


    Andrew Beckett, Feb 25, 2009
    1. Advertisements

  3. Ike Naar

    Ike Naar Guest

    Thanks Andrew. I'm doing maintenance on existing C code that clobbers
    such memory (e.g. by overwriting a character in the middle of a string
    with a null character, in order to truncate the string).
    I'll see if I can rewrite that code.
    Ike Naar, Feb 25, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.