Hi Denis,

> Alloc avail: 0
> [init -> rm_stresser] Round 5
> Quota exceeded! amount=61440, size=8192, consumed=61440
> Uncaught exception of type 'Genode::Allocator::Out_of_memory'
> Warning: abort called - thread: entrypoint
> 
> Is there an easy way to upgrade a session's RAM quota before allocating 
> objects with no available RAM?

you did everything correctly. The problem is actually that core's RM
service misses to catch the 'Allocator::Out_of_memory' exception. The
attached patch rectifies this. In your test program, you need to catch
'Region_map::Out_of_metadata' instead of 'Allocator::Out_of_memory'.
With this minor change, the test passes.

Thank you very much for pointing us to this problem and for the
super-convenient test case! :-)

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
diff --git a/repos/base/src/core/include/rm_session_component.h b/repos/base/src/core/include/rm_session_component.h
index df16fe9..ec4f1f4 100644
--- a/repos/base/src/core/include/rm_session_component.h
+++ b/repos/base/src/core/include/rm_session_component.h
@@ -77,13 +77,16 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
 		{
 			Lock::Guard guard(_region_maps_lock);
 
-			Region_map_component *rm =
-				new (_md_alloc)
-					Region_map_component(_ep, _md_alloc, _pager_ep, 0, size);
+			try {
+				Region_map_component *rm =
+					new (_md_alloc)
+						Region_map_component(_ep, _md_alloc, _pager_ep, 0, size);
 
-			_region_maps.insert(rm);
+				_region_maps.insert(rm);
 
-			return rm->cap();
+				return rm->cap();
+			}
+			catch (Allocator::Out_of_memory) { throw Out_of_metadata(); }
 		}
 
 		void destroy(Capability<Region_map> rm) override
------------------------------------------------------------------------------
_______________________________________________
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to