9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Sam arena allocators
@ 2021-06-28 22:18 silas poulson
  2021-06-28 22:29 ` Rob Pike
  0 siblings, 1 reply; 5+ messages in thread
From: silas poulson @ 2021-06-28 22:18 UTC (permalink / raw)
  To: 9fans

Hi,

Recently discovered a blog post[1] stating Sam used to have arena
based allocators.

Having difficulty finding more about this - does anyone know what the
allocator looked like and why the source returned to using the
standard allocators.

Silas

[1]https://jeremywsherman.com/2012/02/28/memory-allocation-in-sam/


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tf83e4250af593565-M69cd9bb1a4303e77810a75e6
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Sam arena allocators
  2021-06-28 22:18 [9fans] Sam arena allocators silas poulson
@ 2021-06-28 22:29 ` Rob Pike
  2021-06-29  0:33   ` silas poulson
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Pike @ 2021-06-28 22:29 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

After Acme was written, I replaced most of the buffer management code in
Sam with that from Acme, which was more efficient - it did the database
stuff in a different order that was one pass quicker. It's possible the old
code used an arena allocator, I don't remember, but it's possible you're
referring to the code in samterm, which grew up on the Blit and likely had
some compacting arena management code in it to keep the memory footprint
small. As always, though, my memory may be faulty; it compacts too often.

-rob


On Tue, Jun 29, 2021 at 8:20 AM silas poulson <silas8642@hotmail.co.uk>
wrote:

> Hi,
> 
> Recently discovered a blog post[1] stating Sam used to have arena
> based allocators.
> 
> Having difficulty finding more about this - does anyone know what the
> allocator looked like and why the source returned to using the
> standard allocators.
> 
> Silas
> 
> [1]https://jeremywsherman.com/2012/02/28/memory-allocation-in-sam/
> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tf83e4250af593565-Mc9cc98db53ddc23148f52d54
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2627 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Sam arena allocators
  2021-06-28 22:29 ` Rob Pike
@ 2021-06-29  0:33   ` silas poulson
  2021-06-29 23:44     ` noel.hunt
  0 siblings, 1 reply; 5+ messages in thread
From: silas poulson @ 2021-06-29  0:33 UTC (permalink / raw)
  To: 9fans

> On 28 Jun 2021, at 23:29, Rob Pike <robpike@gmail.com> wrote:
> After Acme was written, I replaced most of the buffer management code in Sam
> with that from Acme, which was more efficient 

Right, that makes sense.

> It's possible the old code used an arena allocator, I don't remember,
> but it's possible you're referring to the code in samterm, which grew up
> on the Blit and likely had some compacting arena management code in
> it to keep the memory footprint small.

Possibly, I’m still exploring the code.

Re-reading Sam paper though, memory management section seems to imply
custom allocator, ran on both terminal and host to efficiently hold strings in memory 
via variable length arrays.

> As always, though, my memory may be faulty; it compacts too often.

Ha

Silas
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tf83e4250af593565-M2eda808e9e8fed8b9d6abce0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Sam arena allocators
  2021-06-29  0:33   ` silas poulson
@ 2021-06-29 23:44     ` noel.hunt
  2021-06-30  2:07       ` silas poulson
  0 siblings, 1 reply; 5+ messages in thread
From: noel.hunt @ 2021-06-29 23:44 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

As Rob Pike pointed out, the compacting garbage collector was used in
severalof the programs written for the Blit. The source file in question
is 'gcalloc.c' and it seems to be in sam source as late as 10th Edition.
From a perusal of research source, it seems to have been used in jim, sam,
pads, mux amongst others.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tf83e4250af593565-M2ef2fd88917f26b313efd26b
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1110 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Sam arena allocators
  2021-06-29 23:44     ` noel.hunt
@ 2021-06-30  2:07       ` silas poulson
  0 siblings, 0 replies; 5+ messages in thread
From: silas poulson @ 2021-06-30  2:07 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On 30 Jun 2021, at 00:44, noel.hunt@gmail.com<mailto:noel.hunt@gmail.com> wrote:
The source file in question is 'gcalloc.c' and it seems to be in sam
source as late as 10th Edition. From a perusal of research source, it
seems to have been used in jim, sam, pads, mux amongst others.

Right, thank you for that - forgot sources were available via list.

Will examine closely

Silas

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tf83e4250af593565-M282bbf82ea9329be71eff119
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-30  2:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 22:18 [9fans] Sam arena allocators silas poulson
2021-06-28 22:29 ` Rob Pike
2021-06-29  0:33   ` silas poulson
2021-06-29 23:44     ` noel.hunt
2021-06-30  2:07       ` silas poulson

9fans - fans of the OS Plan 9 from Bell Labs

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9fans

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9fans 9fans/ http://inbox.vuxu.org/9fans \
		9fans@9fans.net
	public-inbox-index 9fans

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9fans


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git