Memory allocation error while running owlready2 pellet reasoner

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Memory allocation error while running owlready2 pellet reasoner

Taha
Hello
I'm using owlready2 to extract more information from the ontology on the runtime using SWRL rules (Rules are saved within the ontology), I'm running owlready2 within realtime system, Pellet in running every 5 seconds in the code.
After 27 minutes i got the following error

`
Traceback (most recent call last):
  File "/home/nt/last_ws/src/test_pkg/src/infer.py", line 221, in <module>
    main()        
  File "/home/nt/last_ws/src/test_pkg/src/infer.py", line 171, in main
    msg = get_infer()
  File "/home/nt/last_ws/src/orca_onto/src/infer.py", line 92, in automata
    sync_reasoner_pellet(my_world, infer_property_values=True, infer_data_property_values=True, debug=False)
  File "/home/nt/.local/lib/python3.5/site-packages/owlready2/reasoning.py", line 239, in sync_reasoner_pellet
    output = subprocess.run(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, check = True).stdout
  File "/usr/lib/python3.5/subprocess.py", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1490, in _execute_child
    restore_signals, start_new_session, preexec_fn)
OSError: [Errno 12] Cannot allocate memory

`
Do you have any solution?
Reply | Threaded
Open this post in threaded view
|

Re: Memory allocation error while running owlready2 pellet reasoner

Jiba
Administrator
Hi,

It seems that you computer is running out of memory.

Owlready maintains a cache of entities. By default, the cache is limited to 65536 entities. It should be OK unless you have a very small memory AND you load more than 65536 distinct entities.

The cache is availble as owlready2.namespace._cache.

If you want to reduce it, you may try:

owlready2.namespace._cache = [None] * 10000

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Memory allocation error while running owlready2 pellet reasoner

Taha
Thanks Jiba