emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set time limit and memory limit for execution of source block


From: Tim Cross
Subject: Re: How to set time limit and memory limit for execution of source blocks
Date: Tue, 04 Feb 2020 18:23:21 +1100
User-agent: mu4e 1.3.7; emacs 27.0.60

This is probably something which would need to be addressed in the
interpreter/compiler of the language you are using rather than within
Emacs or org-mode.

I would suspect that in your case, you are best off tangling the source
blocks to create separate executable scripts/code which you then run
outside of Emacs itself. Running the code blocks from within
org-mode/Emacs is going to adversely impact on the execution time (it
will be slower) and complicates/muddies calculation of memory usage (you
really only want to count the memory used by the child process running
your code, not that of Emacs).

Using tangled source code files will also allow you to use OS tools for
timing and memory metrics (depending on what platform your on).

If your source code blocks are emacs-lisp, things are a little
different. There will still be some overhead which may impact on
performance. I don't think you can easily identify memory useage (i.e.
memory used by your source code as opposed to memory used by Emacs for
everything else).

Anoop GR <address@hidden> writes:

> Dear Emacs hackers,
>
> Like all of you, I think orgmode is the best way to organise study notes.
>
> I am solving competitive programming questions from Topcoder.com
> There are strict guidelines on memory limit of 256MB and time limit of 2sec
> for solutions
>
> How do I enforce the same on my orgmode source blocks.
> I want the execution to stop whenever it exceeds the above limits on memory
> and time.
>
> Long live Emacs,
> Anoop


--
Tim Cross



reply via email to

[Prev in Thread] Current Thread [Next in Thread]