[odb-users] Re: memory leak

Per Edin info at peredin.com
Tue Jan 14 03:35:32 EST 2014


Hi,

A transaction will require resources, be that WinAPI handles or
something else on other systems. I wouldn't care that much about it at
first.

Try not to optimize too early. Make it work first, and then, if you
experience performance problems, try to optimize them away. :)

Cheers,
Per

On Tue, Jan 14, 2014 at 9:15 AM, 黄川 <buptstehc at gmail.com> wrote:
> i have tried by resusing the transaction instance like this:
> odb::transaction::current (*t_);
> db_->execute(sql);
> t_->commit();
> t_->reset(db_->begin());
>
> but the handles is still increasing.
>
>
> 2014/1/14 黄川 <buptstehc at gmail.com>
>
>> sorry, the code should be this:
>> odb::transaction t (db_->begin());
>> db_->execute(sql);
>> t.commit();
>>
>>
>>
>>
>> 2014/1/14 黄川 <buptstehc at gmail.com>
>>
>>> Hi,all! when i test inserting data multiple times , the handles occupied
>>> by my program is increasing from process manager in windows, my code is as
>>> follows:
>>>
>>> odb::transaction t (db_->begin());
>>> db_->persist(m);
>>> db_->execute(sql);
>>> t.commit();
>>>
>>> since every time when i insert a new data, i will create a new
>>> transaction t, i want to know whether i can create this once and reuse
>>> over and over again?thanks!
>>>
>>
>>



More information about the odb-users mailing list