[OpenSER-Devel] RFC: memory management in database modules
Henning Westerholt
henning.westerholt at 1und1.de
Tue Feb 5 14:17:56 UTC 2008
Hi,
i've a question about the 'correct' way to do the memory management for
results in the database modules.
At the moment there existing two different styles:
mysql, unixodbc don't allocate new memory and just assign the string pointer
of the result set to the internal OpenSER representation. The modules that
needs to use this results needs to copy them, because there are not available
after a call to the DB specific result free function.
postgres, db_berkeley allocate new memory and copy all string values from the
database to the internal representation. Modules that uses this driver don't
need to copy there values, even after the freeing of the result set.
As mysql is the most used database, (i assume) that every module copy the
values from the result set after the query execution. This is unnecessary for
the postgres DB, and further prevents me from using only one memory
management function for the internal representation of the DB structures.
As we have many more modules than database connectors in the code, i think it
would make more sense to change the postgres and db_berkeley module to match
the behaviour of the mysql module.
Any comments?
Henning
More information about the Devel
mailing list