--- Jim Purbrick <[EMAIL PROTECTED]> wrote: > I've got the allocation tracking working with the > profiling API, can work out how much memory a script > has allocated and throw an exception from there when > the limit is reached (admitedly after the allocation > which breaks the limit). Is there a way to track how > much of a scripts memory is freed so I can work out > the current allocated total for each script? I > imagine this might be complicated by the GC.
It struck me that one way to trap memory freed by the GC would be to make a call from the finalizer of System.Object, which works fine. All I need to do now is mark each object with the Id of the currently running script when I see it allocated, so I know which script to credit with the object's memory when it's collected. The problem is, when I add a field to System.Object to store the Id of the allocated script, mcs crashes seemingly because I'm adding a field to a class with no base. Admitedly it's a pretty esoteric bug, but it would be nice to have it fixed so I can continue with my crazy plan, which looks like it might just work. Alternatively if anyone can see a less crazy way to make this work, I'd love to hear about that too! Cheers, Jim. Here's the stack trace: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object in <0x0001f> Mono.CSharp.TypeContainer:FindBaseMemberWithSameName (string,bool) in <0x0004f> Mono.CSharp.FieldBase:CheckBase () in <0x000cf> Mono.CSharp.FieldMember:Define () in <0x0001f> Mono.CSharp.Field:Define () in <0x00073> MemberCoreArrayList:DefineContainerMembers () in <0x00014> Mono.CSharp.TypeContainer:DefineContainerMembers (Mono.CSharp.TypeC ontainer/MemberCoreArrayList) in <0x00196> Mono.CSharp.TypeContainer:DoDefineMembers () in <0x0002a> Mono.CSharp.TypeContainer:DefineMembers (Mono.CSharp.TypeContainer) in <0x00042> Mono.CSharp.RootContext:PopulateCoreType (Mono.CSharp.TypeContainer ,string) in <0x00021> Mono.CSharp.RootContext:BootCorlib_PopulateCoreTypes () in <0x00ace> Mono.CSharp.Driver:MainDriver (string[]) in <0x0000f> Mono.CSharp.Driver:Main (string[]) Send instant messages to your online friends http://uk.messenger.yahoo.com _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list