mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 04:03:03 +01:00
Fixed bug CORE-3533 : Firebird memory not released (Using superserver)
This commit is contained in:
parent
32d97c593a
commit
86adbc35de
@ -159,6 +159,11 @@ IMPLEMENT_TRACE_ROUTINE(dsql_trace, "DSQL")
|
|||||||
|
|
||||||
dsql_dbb::~dsql_dbb()
|
dsql_dbb::~dsql_dbb()
|
||||||
{
|
{
|
||||||
|
thread_db* tdbb = JRD_get_thread_data();
|
||||||
|
|
||||||
|
while (!dbb_requests.isEmpty())
|
||||||
|
release_request(tdbb, dbb_requests[0], true);
|
||||||
|
|
||||||
HSHD_finish(this);
|
HSHD_finish(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,8 +189,9 @@ dsql_req* DSQL_allocate_statement(thread_db* tdbb, Attachment* attachment)
|
|||||||
// allocate the request block
|
// allocate the request block
|
||||||
|
|
||||||
MemoryPool& pool = *tdbb->getDefaultPool();
|
MemoryPool& pool = *tdbb->getDefaultPool();
|
||||||
dsql_req* const request = FB_NEW(pool) dsql_req(pool);
|
dsql_req* const request = FB_NEW(pool) CompiledStatement(pool);
|
||||||
request->req_dbb = database;
|
request->req_dbb = database;
|
||||||
|
database->dbb_requests.add(request);
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
@ -2581,6 +2587,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
|
|||||||
MemoryPool& pool = *tdbb->getDefaultPool();
|
MemoryPool& pool = *tdbb->getDefaultPool();
|
||||||
CompiledStatement* statement = FB_NEW(pool) CompiledStatement(pool);
|
CompiledStatement* statement = FB_NEW(pool) CompiledStatement(pool);
|
||||||
statement->req_dbb = database;
|
statement->req_dbb = database;
|
||||||
|
database->dbb_requests.add(statement);
|
||||||
statement->req_transaction = transaction;
|
statement->req_transaction = transaction;
|
||||||
statement->req_client_dialect = client_dialect;
|
statement->req_client_dialect = client_dialect;
|
||||||
statement->req_traced = true;
|
statement->req_traced = true;
|
||||||
@ -2915,7 +2922,12 @@ static void release_request(thread_db* tdbb, dsql_req* request, bool drop)
|
|||||||
|
|
||||||
if (drop)
|
if (drop)
|
||||||
{
|
{
|
||||||
request->req_dbb->deletePool(&request->req_pool);
|
dsql_dbb* dbb = request->req_dbb;
|
||||||
|
size_t pos;
|
||||||
|
if (dbb->dbb_requests.find(request, pos)) {
|
||||||
|
dbb->dbb_requests.remove(pos);
|
||||||
|
}
|
||||||
|
dbb->deletePool(&request->req_pool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ public:
|
|||||||
MemoryPool& dbb_pool; // The current pool for the dbb
|
MemoryPool& dbb_pool; // The current pool for the dbb
|
||||||
Database* dbb_database;
|
Database* dbb_database;
|
||||||
Attachment* dbb_attachment;
|
Attachment* dbb_attachment;
|
||||||
|
Firebird::SortedArray<dsql_req*> dbb_requests;
|
||||||
dsql_str* dbb_dfl_charset;
|
dsql_str* dbb_dfl_charset;
|
||||||
#ifdef SCROLLABLE_CURSORS
|
#ifdef SCROLLABLE_CURSORS
|
||||||
USHORT dbb_base_level; // indicates the version of the engine code itself
|
USHORT dbb_base_level; // indicates the version of the engine code itself
|
||||||
@ -149,7 +150,9 @@ public:
|
|||||||
Firebird::Mutex dbb_cache_mutex; // mutex protecting the DSQL metadata cache
|
Firebird::Mutex dbb_cache_mutex; // mutex protecting the DSQL metadata cache
|
||||||
|
|
||||||
explicit dsql_dbb(MemoryPool& p) :
|
explicit dsql_dbb(MemoryPool& p) :
|
||||||
dbb_pool(p), dbb_charsets_by_id(p, 16)
|
dbb_pool(p),
|
||||||
|
dbb_requests(p),
|
||||||
|
dbb_charsets_by_id(p, 16)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~dsql_dbb();
|
~dsql_dbb();
|
||||||
@ -382,12 +385,6 @@ enum REQ_TYPE
|
|||||||
class dsql_req : public pool_alloc<dsql_type_req>
|
class dsql_req : public pool_alloc<dsql_type_req>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit dsql_req(MemoryPool& p)
|
|
||||||
: req_pool(p),
|
|
||||||
req_blr_data(p)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
dsql_req* req_parent; // Source request, if cursor update
|
dsql_req* req_parent; // Source request, if cursor update
|
||||||
dsql_req* req_sibling; // Next sibling request, if cursor update
|
dsql_req* req_sibling; // Next sibling request, if cursor update
|
||||||
dsql_req* req_offspring; // Cursor update requests
|
dsql_req* req_offspring; // Cursor update requests
|
||||||
@ -427,6 +424,11 @@ public:
|
|||||||
bool req_traced; // request is traced via TraceAPI
|
bool req_traced; // request is traced via TraceAPI
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
dsql_req(MemoryPool& p)
|
||||||
|
: req_pool(p),
|
||||||
|
req_blr_data(p)
|
||||||
|
{
|
||||||
|
}
|
||||||
// Request should never be destroyed using delete.
|
// Request should never be destroyed using delete.
|
||||||
// It dies together with it's pool in release_request().
|
// It dies together with it's pool in release_request().
|
||||||
~dsql_req()
|
~dsql_req()
|
||||||
|
Loading…
Reference in New Issue
Block a user