Resource leakage?

Stefan Kalkowski stefan.kalkowski at ...1...
Fri Mar 22 10:58:52 CET 2013


Hi Petr,

thanks for the review!

I assume you're using an older version of the Genode framework? The
memory leak you've described was removed by the following commit:


https://github.com/genodelabs/genode/commit/b38fee28672a9ba2ad4c94b1f5c69317b90f8712

To get the recent stable version of Genode, please checkout the master
branch of Genode's githup repository:

  https://github.com/genodelabs/genode.git

Best Regards
Stefan

On 03/22/2013 06:48 AM, Petr Ovtchenkov wrote:
> Hello,
> 
> File ports-foc/src/lib/l4lx/rm.cc, in method  Region_manager::reserve_range I see possible resource
> leakage:
> 
> 
> 
> Region* Region_manager::reserve_range(Genode::size_t size, int align,
>                                       Genode::addr_t start)
> {
>         using namespace Genode;
>         void* addr = 0;
> 
>         while (true) {
> 
>                 try {
>                         /*
>                          * We attach a managed-dataspace as a placeholder to
>                          * Genode's region-map
>                          */
>                         Rm_connection *rmc = new (env()->heap()) Rm_connection(0, size);
>                         addr = start ? env()->rm_session()->attach_at(rmc->dataspace(), start)
>                                      : env()->rm_session()->attach(rmc->dataspace());
>                         //PDBG("attach done addr=%p!", addr);
>                         break;
>                 } catch(Rm_session::Attach_failed e) {
>                         PWRN("attach failed start=%lx", start);
>                         if (start) /* attach with pre-defined address failed, so search one */
>                                 start = 0;
>                         else
>                                 return 0;
>                 }
>         }
> 
>         /*
>          * Mark the region reserved, in our region-map by setting the
>          * dataspace reference to zero.
>          */
>         alloc_addr(size, (addr_t)addr);
>         Region reg((addr_t)addr, size, 0);
>         metadata(addr, reg);
>         return metadata(addr);
> }
> 
> If env()->rm_session()->attach_at or env()->rm_session()->attach throw exception (looks, this is normal flow),
> then rmc and space, allocated from env()->heap() will be lost, right?
> 
> --
> 
> With best regards,
> 
>   -- ptr
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
> 

-- 
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ ยท http://genode.org/




More information about the users mailing list