<!-- MHonArc v2.4.4 --> <!--X-Subject: Re: Strings & Memory Usage --> <!--X-From-R13: pynjerapNphc.uc.pbz --> <!--X-Date: from tacitus.globecomm.net [207.51.48.7] by mx5.ibm.net id 861119980.145090-1 Tue Apr 15 15:59:40 1997 --> <!--X-Message-Id: 199704151604.JAA13426#xsvr3,cup.hp.com --> <!--X-Content-Type: text/plain --> <!--X-Reference: 199704150252.CAA220829#out1,ibm.net --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, Re: Strings & Memory Usage</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:clawrenc#cup,hp.com"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00141.html">Previous</a> | <a href="msg00143.html">Next</a> ] Thread: [ <a href="msg00141.html">Previous</a> | <a href="msg00146.html">Next</a> ] Index: [ <A HREF="author.html#00142">Author</A> | <A HREF="#00142">Date</A> | <A HREF="thread.html#00142">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>Re: Strings & Memory Usage</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: Mud Dev Mailing List <<A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A>></LI> <LI><em>Subject</em>: Re: Strings & Memory Usage</LI> <LI><em>From</em>: <A HREF="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</A></LI> <LI><em>Date</em>: Mon, 14 Apr 97 08:59:57 -0700</LI> <LI><em>Reply-to</em>: <A HREF="mailto:claw#null,net">claw#null,net</A></LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> In <199704150252.CAA220829#out1,ibm.net>, on 04/14/97 at 08:07 PM, Greg Munt <greg#uni-corn,demon.co.uk> said: >Is there a common way to save the memory used up by storing strings? Yup, its called reference counting. There are several implementations, and a vast number of optimisations, but the basic trick is having a central module control storage of all strings. Whenever a string is submitted to the module for storage, it compares it to the other strings it finds, and if it finds a dupe, increments the reference count on the dupe and returns that, or adds it as a new string (no other copy found). Obvious optimisations enclude hashing the string lookups to speed determining if the string in question already exists in the pool. Note: OSE has a very slick reference counted string class. >I'm sure something was said on this subject in the RGMA 'MUD Memory' >thread (by George Reese, IIRC) Bugger. Another thread to dig up. >I will probably be using some sort of bytecode compilation on my mud >now. Would this method of memory saving simply involve checking a >list of those strings currently in memory, and either adding a new >string, or adding a pointer to an old string? (that would probably >slow down the process unless the storage structure was right, tho) Bytecoding really has nothing much to do with string compression of reference counting. If fact, for my implementation bytecoding _costs_ me memory as I keep the flat-ASCII version and the bytecoded version about (I need easy compile/decompile). -- J C Lawrence Internet: claw#null,net (Contractor) Internet: coder#ibm,net ---------------(*) Internet: clawrenc#cup,hp.com ...Honorary Member Clan McFUD -- Teamer's Avenging Monolith... </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00141.html">Re: Strings & Memory Usage</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00143.html">Re: Threads and Sockets (Was Ho hum)</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00141.html">Re: Strings & Memory Usage</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00146.html">Re: Strings & Memory Usage</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00142"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00142"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><STRONG>Re: Threads and Sockets (Was Ho hum)</STRONG>, <EM>(continued)</EM> <ul compact> <LI><strong><A NAME="00168" HREF="msg00168.html">Re: Threads and Sockets (Was Ho hum)</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 21 Apr 1997, 04:09 GMT </LI> </ul> </LI> <LI><strong><A NAME="00135" HREF="msg00135.html">Strings & Memory Usage</A></strong>, Greg Munt <a href="mailto:greg#uni-corn,demon.co.uk">greg#uni-corn,demon.co.uk</a>, Tue 15 Apr 1997, 03:13 GMT <UL> <li><Possible follow-up(s)><br> <LI><strong><A NAME="00138" HREF="msg00138.html">Re: Strings & Memory Usage</A></strong>, Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Tue 15 Apr 1997, 09:59 GMT </LI> <LI><strong><A NAME="00141" HREF="msg00141.html">Re: Strings & Memory Usage</A></strong>, Shawn Halpenny <a href="mailto:rsh#dos,nortel.com">rsh#dos,nortel.com</a>, Tue 15 Apr 1997, 22:28 GMT </LI> <LI><strong><A NAME="00142" HREF="msg00142.html">Re: Strings & Memory Usage</A></strong>, clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Tue 15 Apr 1997, 22:59 GMT </LI> <LI><strong><A NAME="00146" HREF="msg00146.html">Re: Strings & Memory Usage</A></strong>, ashen <a href="mailto:ashen#pixi,com">ashen#pixi,com</a>, Thu 17 Apr 1997, 00:55 GMT </LI> <LI><strong><A NAME="00169" HREF="msg00169.html">Re: Strings & Memory Usage</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 21 Apr 1997, 04:03 GMT </LI> </UL> </LI> <LI><strong><A NAME="00128" HREF="msg00128.html">Re: project management (or coding, kings, and other things)</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 14 Apr 1997, 11:15 GMT <LI><strong><A NAME="00127" HREF="msg00127.html">Who is Steward and what can he do for me?</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 14 Apr 1997, 10:29 GMT </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>