@@ -22,6 +22,7 @@ from rapidsmpf.streaming.core.context cimport Context, cpp_Context
2222import asyncio
2323
2424import rapidsmpf.utils.string
25+ from rapidsmpf.utils.memory import check_reservation_size
2526
2627# Sentinel indicating that net_memory_delta estimation has not yet been implemented.
2728#
@@ -394,6 +395,7 @@ cdef class MemoryReserveOrWait:
394395 RuntimeError
395396 If shutdown occurs before the request can be processed.
396397 """
398+ check_reservation_size(size)
397399 cdef shared_ptr[unique_ptr[cpp_MemoryReservation]] c_ret
398400 future = asyncio.get_running_loop().create_future()
399401 Py_INCREF(future)
@@ -444,6 +446,7 @@ cdef class MemoryReserveOrWait:
444446 RuntimeError
445447 If shutdown occurs before the request can be processed.
446448 """
449+ check_reservation_size(size)
447450 cdef shared_ptr[pair[unique_ptr[cpp_MemoryReservation], size_t]] c_ret
448451 future = asyncio.get_running_loop().create_future()
449452 Py_INCREF(future)
@@ -497,6 +500,7 @@ cdef class MemoryReserveOrWait:
497500 --------
498501 reserve_or_wait
499502 """
503+ check_reservation_size(size)
500504 cdef shared_ptr[unique_ptr[cpp_MemoryReservation]] c_ret
501505 future = asyncio.get_running_loop().create_future()
502506 Py_INCREF(future)
@@ -602,6 +606,8 @@ async def reserve_memory(
602606 ... allow_overbooking=False,
603607 ... )
604608 """
609+ check_reservation_size(size)
610+
605611 if allow_overbooking is None :
606612 allow_overbooking = ctx.options().get(
607613 " allow_overbooking_by_default" ,
0 commit comments