From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8bfa8c460ead1701 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Problems with dynamic allocation in tasks Date: Wed, 25 Jul 2007 13:25:37 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1185379864.592973.73220@b79g2000hse.googlegroups.com> <1185383088.872717.223020@l70g2000hse.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1185384339 7897 192.74.137.71 (25 Jul 2007 17:25:39 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 25 Jul 2007 17:25:39 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:YTNsMoNInprkyKoYqxyByzwbBRA= Xref: g2news2.google.com comp.lang.ada:1176 Date: 2007-07-25T13:25:37-04:00 List-Id: ldb writes: > I'm at a loss for how this possible using storage pools. You're right -- it's not as simple as I implied. > I've worked a good deal with storage pools but perhaps my vision of > their functionality is too narrow. It was my belief that a storage > pool can only be used globally for a particular type. Correct. The Allocate routine for your pool would have to grab a pointer to the "real" pool out of thread-local storage, and allocate memory from that. Whether thread-local storage is efficient enough depends on the system. I don't think there's any portable and efficient way to use thread-local storage -- you'd have to program that. Task_Attributes doesn't count -- it does locking, which is what you're trying to avoid. >...These dynamic > allocations are done with global types, ie, Access_Vector. Certainly a > storage pool can be attached to Access_Vector and intercept, figure > out which thread its in.. but then what? In a "simple" implementation, > I'm still depending on System.Memory (which is malloc()) and it's > still gonna hit these mutexes. > > I -could- make the storage-pool implement a full allocator so it's not > dependant on malloc() for each allocation. Well, yeah, if you implement your own storage pool, you have to implement it. ;-) >...This is alot of work and > there are alot of types. Yes, it's a lot of work. Not sure what you mean by "a lot of types". Many types can share the same pool, if you program the pool to work for multiple sizes and alignments. You have to write "for T'Storage_Pool use ..." on each type, though. >...If I go this route, I'd prefer to do a global > replace (which goes back to my original question of how to do it like > gmem does it). - Bob