![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
int db_create(DB **dbp, DB_ENV *dbenv, u_int32_t flags); Here memory will be allocted for the variable *dbp. Now while closing the DB the corresponding handler also should be destroyed, otherwise it will lead to a memory leak. Now my query is that is there any interface to destroy the handler created by funtion db_create? if there is no interface then where BerklyDB will release this memory? |
#3
| |||
| |||
|
|
"pai" <paimailbox (AT) gmail (DOT) com> writes: int db_create(DB **dbp, DB_ENV *dbenv, u_int32_t flags); Here memory will be allocted for the variable *dbp. Now while closing the DB the corresponding handler also should be destroyed, otherwise it will lead to a memory leak. Now my query is that is there any interface to destroy the handler created by funtion db_create? if there is no interface then where BerklyDB will release this memory? I expect the memory to be released when I call (*dbp)->close(*dbp) to close the handle. And I'd call it a bug in BDB when this does not happen. Do you have evidence for such a bug? Why would/should there be a different interface? best regards Patrick |
#4
| ||||
| ||||
|
|
As you said the memory might be released during db->close.. |
|
Now coming to the interface requirement, whenever we call the interface for creating some object like CREATE(&pObj) then also we look for it's destructor like DESTROY(pObj). |
|
then then there won't be any confusion, but in berkly this is not followed, db->close might be releasing the memory which is not allocated in db->open. |
|
This way of providing the interface will create the ambiguity. |
#5
| |||
| |||
|
|
Bellow interface will be called for creating the DB handler, int db_create(DB **dbp, DB_ENV *dbenv, u_int32_t flags); .... Now my query is that is there any interface to destroy the handler created by funtion db_create? if there is no interface then where BerklyDB will release this memory? |
![]() |
| Thread Tools | |
| Display Modes | |
| |