|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Size of an ObjectIs there any way to get the memory size for an instance of an object, like in
bytes or something like that. I have an UNDO feature on one of my applications and I'd like to be able to display a warning when the UNDO que got to a certain size. I can't use UndoQue.Count since the objects in the que can vary from strings to DataTable Rows to other large objects. -- Dennis in Houston Marshal.SizeOf
Show quoteHide quote "Dennis" <Den***@discussions.microsoft.com> wrote in message news:D26833B6-5CAD-41CC-B952-5B241D4420BE@microsoft.com... > Is there any way to get the memory size for an instance of an object, like > in > bytes or something like that. I have an UNDO feature on one of my > applications and I'd like to be able to display a warning when the UNDO > que > got to a certain size. I can't use UndoQue.Count since the objects in the > que can vary from strings to DataTable Rows to other large objects. > -- > Dennis in Houston Norman Diamond wrote:
> Marshal.SizeOf That won't help you. Marshal.SizeOf does NOT return the size of a> managed object. It returns the size the object will be when marshaled to unmanaged memory. It's return value will almost certainly be different then the actual size of the object in managed memory. -- Tom Shelton Dennis wrote:
> Is there any way to get the memory size for an instance of an object, like in Dennis -> bytes or something like that. I have an UNDO feature on one of my > applications and I'd like to be able to display a warning when the UNDO que > got to a certain size. I can't use UndoQue.Count since the objects in the > que can vary from strings to DataTable Rows to other large objects. > -- > Dennis in Houston I don't think there is a way to acurately get the size of an object in memory - and I believe this is on purpose. As for a solution to your problem - I'll have to think about it a little more (maybe someone else will come up with something)... -- Tom Shelton Thanks. If I could an approximation it would probably suffice for what I
want to do. -- Show quoteHide quoteDennis in Houston "Tom Shelton" wrote: > > Dennis wrote: > > Is there any way to get the memory size for an instance of an object, like in > > bytes or something like that. I have an UNDO feature on one of my > > applications and I'd like to be able to display a warning when the UNDO que > > got to a certain size. I can't use UndoQue.Count since the objects in the > > que can vary from strings to DataTable Rows to other large objects. > > -- > > Dennis in Houston > > Dennis - > > I don't think there is a way to acurately get the size of an object in > memory - and I believe this is on purpose. As for a solution to your > problem - I'll have to think about it a little more (maybe someone else > will come up with something)... > > -- > Tom Shelton > >
can a method implement an interface and handle an event at the same time?
how to rollback a procedure (sqlserver) from VB2005? determining end of file FileSystemWatcher across the network (newbie VB 2005 EE ) composing string from variables how to make base and derived class use the same member variable? Epson TM-T88 Drawer Kick Subtract Days from a Date Deserializing object How to licensce a .NET desktop application |
|||||||||||||||||||||||