Lisp HUG Maillist Archive

allocation during sleep ?

allocation during sleep ? Hello,

Does anobody know why the system allocate several dozen of kb while running this simple test ?

(defun test-allocation ()
  (let ((allocation (system::total-allocation)))
    (dotimes (i 100) (sleep 0.01))
    (- (system::total-allocation) allocation)))

(test-allocation) => 34984 (??)

Thanks

Denis

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------

Re: allocation during sleep ?

On 2/14/08, Denis Pousseur <denis.pousseur@gmail.com> wrote:
>  Does anobody know why the system allocate several dozen of kb while running
> this simple test ?

While it may appear that this test is doing the allocation, the number
reported is being affected by other processes in the image.
Try running the test in a console image to avoid getting allocation 'crossover'.

sleep does cons 44 bytes per call but thats hardly extreme.

sean


Re: allocation during sleep ?




Le 15/02/08 11:42, « [NOM] » <[ADRESSE]> a écrit :

> Try running the test in a console image to avoid getting allocation
> 'crossover'.

Ah yes, that's it

Thanks

Denis

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: allocation during sleep ?

* Denis Pousseur <denis.pousseur@gmail.com>:
> Does anobody know why the system allocate several dozen of kb while
> running this simple test ?

> (defun test-allocation ()
>   (let ((allocation (system::total-allocation)))
>     (dotimes (i 100) (sleep 0.01))
>     (- (system::total-allocation) allocation)))

I'm not sure what you expect sleep to do.  If it had just been a busy
wait-loop of some sort, I guess it probably wouldn't cons, but
presumably a context switch happens when you call sleep in Lispworks
and other implementations which support multiprocessing.  It doesn't
seem unlikely that this requires a bit of allocation.

-- 
johs


Updated at: 2020-12-10 08:44 UTC