Too Big to Serialize??

I have run into the same problem someone else here mentioned before, namely that I get a StackOverflowError when I try to deserialize an object I successfully serialized. I wondered if the Java serialization routine (the default, since I didn't override any readObject or writeObject methods) had a bug and had worked itself into an infinite loop, but I think my object may simply be too large.
The data structure I'm trying to serialize contains hundreds of thousands of objects and has a complex pointer structure (used to sort the elements in more than one direction at once and also as a hash map) plus several thousand collection objects referencing small subsets of the set of objects in the large data structure. This means there are cycles in the object graph--serialization is supposed to be able to handle that, right?
Trying to serialize my object (using the writeObject method) initially resulted in a StackOverflowError, but I got results when I increased the stack size. Unfortunately, I still can't read them back in, even with a Java stack size of 10G and a native stack size of 8M.
Has anyone overcome a problem like this by writing your own serialization routines? I don't see how I'd get around having the same problem the default versions seem to be having--I think they're simply going into deep recursion on the pointers before coming back up.
Here is a snippet of the stack trace:
java.lang.StackOverflowError
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2163)
at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2658)
at java.io.ObjectInputStream.readHandle(ObjectInputStream.java:1373)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1429)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
[The last four lines are repeated over and over.]
By the way, I had the same problem I have seen reported (but not solved) here earlier with StackOverflowError not printing a stack trace, even when printStackTrace() is explicitly called on it, in Java 1.4.2. To get the stack trace above, I had to use Java 1.4.1_05.

I've discovered that serializing the object using writeObject to a FileOutputStream caused a StackOverflowError, even though it produced a file, so that could have to do with why it is getting a StackOverflowError trying to read in that file, or at least it is probably the same problem in both cases.
I get a very analogous error trying to write the object:
java.lang.StackOverflowError
at java.io.FileOutputStream.write(FileOutputStream.java:257)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1637)
at java.io.ObjectOutputStream$BlockDataOutputStream.write(ObjectOutputStream.java:1601)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1323)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1302)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1245)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
[The last four lines are repeated over and over.]
As I mentioned, I didn't override the writeObject method for any class, and I only make one call to writeObject on my main object--that one call results in this problem.
I wonder if the default serialization mechanism could be going about things in a dumb way that could cause problems for large, multiply-linked data structures like mine.
For example, suppose the pseudocode for writeObject looked like this:
writeObject(Object o){
writeObject(first field);
writeObject(second field);
writeObject(last field);
Then suppose I had a doubly-linked list of 100,000 listnodes like this:
class ListNode{
DataClass data;
ListNode next;
ListNode previous;
Then suppose I tried to serialize the first ListNode.
The serialization would behave like this:
write data;
serialize next:
---write data;
---serialize next:
------write data;
------serialize next:
---------write data;
---------serialize next:
There would be 100,000 function calls on the stack before it got to the end of the list, and it still wouldn't have finished serializing the first ListNode. Then when it got to the end of the list, it would continue serializing that object by proceeding through the previous pointers, so there would be 200,000 function calls on the stack before it finished processing the last ListNode. When you consider that my DataClass objects are themselves complex objects with pointers pointing, among other things, back to the ListNodes (I'm simplifying my structure for the purposes of discussion), it's easy for me to imagine that a serialization routine written in a simple way would simply fill up the stack before ever returning from its first function call. How many function calls would that take??
The only way I see around that problem would be to rewrite all the serialization routines for my objects in some way so they wouldn't be recursive, however I could do that. Am I missing something here?

Similar Messages

  • I need to downsize phots to publish on a website but they are too big . In help it says when I select a photo it gives me the option to downsize. It does NOT. ?

    I can't figure out how to downsize my photos for a website that won't take anything above 3MB my Photos are 4MB. Even when I send them in an email, they are too big to send more than 3 at a time and I don't know how to fix it! Help says that when I select a photo it gives me the option to downsize. It does NOT?????

    This is the iPhoto for iOS forum. Are you asking about iPhoto on your Mac?
    In iPhoto on your Mac select Export and you will have the option to select a size for your photo.
    In iPhoto for iOS this capability is not there. I use PhotoForege2 on my iPad to resize my photos to meet the requirements you describe.

  • Saving animated gif error - canvas size too big?

    Hi,
    i have been asked to create an animated gif which has a snow effect in the background. The animation runs pretty well using the pattern style to move the animated snow down. The problem is when I try to export the animation the save for web dialogue window freezes and I can't quit photoshop. I have tried to make the canvas (image size) smaller and it works.
    Is there a memory problem with creating animations in Photoshop if the document size is too big, im running a 3000x1000px at 72dpi
    TThe animation would be used on a web app, which a script could probably do a better job, but I need to try this first.
    thanks
    lister

    Something is very wrong here. The point behind using GIFs is that they are small and OK to put on a Web site.
    First thing: forget all about PPI - this has absolutely no relevance to Web/screen images; it is only used for printing. You need to think about the pixel size.
    So, how big in pixels are your starting images?
    How big do you want the resulting GIF to be? Again, you have to decide in pixels, as the viewing size will depend upon screen resolution of the person looking at it. You can use a notional PPI of 70-100 to guess how big it will be in inches, but that's all it is - a guess.
    Is this getting you going in the right direction?
    I cannot resist commenting that I hate almost all animated GIFs as they reduce Web site usability so much.

  • When I open my iPad the page is too big for the screen and won't shrink down. The keypad has also become very 'sticky'

    Recently when I open any apps the pages are too big for the screen. They shrink when pinched but immediately become bigger again. It's very difficult to scroll too. The keypad has become very sticky. Missing letters and spaces when I type and needing to tap the keys much harder than usual

    I have the exact same problem, I think.  I was on my iPad 3's home page swiping R-L to locate a certain icon when all of a sudden the screen appeared to get HUGE.  So big I could only see one or two icons.  I couldn't even turn it off to try a reboot because after I pushed the sleep/wake button, I couldn't find the red slide bar.  I finally just had to wait for the battery to die, then recharge it, and it looked normal again.  I also spoke with several friends who haven either iPads or iPhones, and they've all had this happen to them.  I checked my accessibility settings, and Zoom was already off.  So what is causing this problem for so many people, and what can we do to prevent it?  Please help.

  • Hi! I need help, today I connected my mac Book Air to a tv for a presentation and as soon as I conected it the image on my screen went bigger. And I cant find the way to put it back as it was before. The Images are too big! heelp

    Hi! I need help, today I connected my mac Book Air to a tv for a presentation and as soon as I conected it the image on my screen went bigger. And I cant find the way to put it back as it was before. The Images are too big! heelp

    Morning DeeHutton,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at this article:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/ts2802
    Best of luck,
    Mario

  • My homescreen won't resize and I can't access anything because everything is too big to navigate.  Help.

    My homescreen won't resize and I can't access anything because everything is too big to navigate.  Help.

    Double-tap the screen with three fingers to disable Zoom.
    To turn off Zoom go to Settings > General > Accessibility > Zoom and turn this Off.

  • When doing a second "Organize Library" cuz the first was too big, will iTunes recognize what's already copied over?

    I'm stuck with a large folder of music on my PC in My Music folder. And I used "Organize Library" in iTunes but it didn't copy everything over because the amount of music was too big. I've deleted the original copies of music outside of iTunes to open up more space and was wondering if I do a second "Organize Library" if it will recognize that some of the music has already been copied over.

    I don't know what "restore the iPod" is
    It's usually the second thing to do (after Reset) when the iPod is not working correctly.
    Select the iPod in iTunes and click Restore.
    See this -> Restoring iPod to factory settings
    what about my main question? Can I go back to "sync all" but manually block certain albums?
    No because sync all is just that.
    Sycning specific playlists should work fine. And you can create more than one and sync which ones you want.

  • I have my iTunes library on an external HD because it is too big for my iMAC 500GB HD. I want to backup my external HD. Can I do this with any Apple cloud product or should I look elsewhere? Also is it worth just buying another external HD to back up

    I have my iTunes library on an external HD because it is too big for my iMAC 500GB HD. However, it is not backed up, so I need a solution to backup my external HD. Can I do this with any Apple cloud product or should I look elsewhere for cloud products? Will it be cheaper/easier just to buy another external HD to back up my existing external HD? Thanks

    I don't know if this is me adding files to iTunes when the external wasn't connected
    it is.
    is it OK to just keep deleting that library on the Air?
    i wouldn't - at least not until i
    mount the external
    point iTunes media folder location back to the external via preferences > advanced
    consolidate my library via file > library > organize library
    The ntfs hasn't seem to be causing any problems, but I've always wanted to know.
    in order for your Mac to write to NTFS drives, it needs some help by installing e.g. the NTFS 3G driver. apparently that or something similar is installed on your Mac already. preferably, it would be formatted for Mac but then windows machines would need to have e.g. MacDrive installed to recognize the drive.

  • I recorded an interview on my iPad using the iTalk app. How can I transfer that audio to my MacBook Pro? The file is too big to email.

    I recorded an interview on my iPad using the iTalk app. How can I transfer that audio to my MacBook Pro? The file is too big to email.

    Use DropBox. https://www.dropbox.com/help/84/en
     Cheers, Tom

  • The "other" memory section on my Mac is WAY too big.

    Hey everyone!
    I know there are a LOT of discussions about this topic, but none of them really seemed to work for me. So the other day I got an error saying "Your startup disk is almost full". I immediately checked the storage section of "About my Mac", and sure enough, something like 100 GB were taken up by local backups. To fix this issue, I disabled local backups via this terminal command: sudo tmutil disablelocal.
    I did a restart and checked my storage again. This time, it looked like this (and still does):
    All of what used to be backups is now other. And the reason I have those 900 or so MB of backups is because I eventually turned those on again (with the reverse of the above command) in an effort to fix this. Out of options, I then went to the apple store, where they told me to just delete stuff that was too big. So I got a 1 TB drive and started copying and deleting stuff. The main thing I got rid of was a giant windows VM I had. And just to prove that something's wrong here, look at the breakdown of my files from OmniDiskSweeper:
    If you do the math, I should have about 100 GB more free than I do now. I've tried:
    Turning the thing off then on (you'd be surprised how often that works)
    Resetting the PRAM
    Forcing spotlight to reindex the machine
    Throwing the machine out the window (well, not quite)
    What I think might be the cause:
    This is a stab in the dark here, but possibly all those GB of backups tried to delete themselves and somehow corrupted and aren not called backups anymore by the system?
    Just one more thing: I noticed that OmniDiskSweeper showed a volume I don't recognize. It's called MobileBackups. Maybe that has something to do with it?
    I'll appreciate your help.
    Thanks!

    Although the guide is a little dated, a lot of the information there is really great and helps you track down a lot of files that are just taking up way too much space on your hard drive.
    http://pondini.org/OSX/DiskSpace.html
    I just did this the other day on my Air running 10.9 and recovered around 50GB of disk space, so there is potentially a lot you can do. I suggest following the steps on this guide (to the T, don't want to mess anything up) and go from there. Don't delete ANYTHING that you are not aware of the function, and remember that searching for names of files is a great way to determine whether or not you need it. Some files that SEEM like junk and take up a considerable amount of space are system files that will either be replaced the next time you boot up or render you computer useless entirely.
    For example, there is a file that saves the state of your computer just before it goes to sleep so that it can return quickly when you start up again, and that file is normally the size of the amount of RAM you have (I have 4GB of RAM, so the file was 4GB). After doing some research, this file will either be recreated if deleted, or your sleep mode will not be able to function properly if the file is deleted. So again, just tread lightly.
    Also, there is an application I used to get rid of a bunch of duplicate files that I had on my drive called Gemini (http://macpaw.com/gemini), which I recommend using to clean up documents. Again, be careful, you don't want to go deleting files that you are using that the application mistook for a duplicate.
    Hope this helps!

  • I'm trying to open a 900kb Word doc (240pages) in Pages but get this error message:  Import Warning - A table was too big. Only the first 40 columns and 1,000 rows were imported.

    I'm trying to open a 900kb Word doc (240pages) in Pages but get this error message:  Import Warning - A table was too big. Only the first 40 columns and 1,000 rows were imported.

    Julian,
    Pages simply won't support a table with that many rows. If you need that many, you must use another application.
    Perhaps the originator could use a tabbed list rather than a table. That's the only way you will be able to contain a list that long in Pages. You can do the conversion yourself if you open the Word document in LibreOffice, Copy the Table, Paste the Table into Numbers, Export the Numbers doc to CSV, and import to Pages. In Pages Find and Replace the Commas with Tabs.
    There are probably other ways, but that's what comes to mind here.
    Jerry

  • I upgraded because they said my files were too big but I've emailed files a lot prior.  now after the upgrade I have a completed file to emial to someone, enter all the data, and there is no "SEND" button.  how do i send these files and why isnt it just l

    I have often sent pdf or other files with adobe by email with no problem.
    this file it said was too big so I'd have to upgrade to send it.   so I upgraded it.  I followed all the instructions, email, etc, etc, and its' ready to go but there is no SEND button.  how do I sent my file?

    Are you still experiencing a problem with Adobe Send?  We inadvertently introduced a problem earlier today (now fixed), but you reported your issue was last night.
    Anyway, can you check again?

  • I am having trouble with a video.  I have tried to copy it to a flash drive because it is too big to fit on a DVD, it says it is too large for the volumes format.  Please advise.

    I have done many DVD's for seniors for graduation so I am familier with Imovie.  I have just finished a projec that is a combination of video, music and stills.  I shared it through idvd.  Now I can't burn it to a dvd because it is too large.  It is too big even for a two sided disk.  I have researched it and i find that blue ray would be big enough.  Does apple offer  blue ray burner?  if so, what is the cost?  I tried another route and took my external hard drive to copy it to a PC.  there computer wouldn't recongize my drive.  I am assuming it is because it is formated for apple.  I tired copying it to a flash drive and and it says that it can't be copied because it is too large for the volume's format.  Suggestions?   PLEASE!!!!!

    Could the video be too big because of using too high a resolution?   480p is sufficient for a DVD.  the thread at:
    https://discussions.apple.com/thread/5868958?tstart=30
    may be of help.
    Apple does not support Blue ray - you have to use a thrid party application like Toast.
    To transfer the video to a PC you need a FAT-formatted hard drive (or of course a sufficiently big memory stick).
    You could also go via a network, via the cloud (eg Dropbox) or with 'Wetransfer" or similar.
    Geoff.

  • Itunes is too big for my laptop, i moved it to an external hard drive and now it's lost

    My laptop was too slow and the hard drive was full so I added memory and it was still too full. I bought an external hard drive and tried moving my itunes to it. But now itunes can't find any of my music. I tried moving the entire itunes folder onto the external hard drive and still itunes can't find it. I tried moving everything back to the laptop - but it won't accept the file because its too big. Help!

    iPods don't look for the library. iTunes does.
    I recently moved my itunes music folder
    Don't move your music folder.
    Let iTunes do it.
    Point iTunes prefs to the location where you wan tit.
    Then go to menu Advanced -> *Consolidate library*.
    This will copy the iTunes music folder to the location in iTunes prefs.

  • Disk image of HD -- "image/device too big"

    I'm trying to make a disk image of my hard drive as a backup. I did this with the other three Macs in my house, using Disk Utility and saving them to an external Firewire drive. No problem. But when I try to do the same thing with my G5, I get a message saying "image/device is too big." If I was getting this message from my wife, I guess I'd be flattered ... from my Mac, not so much.
    The thing is, I should have plenty of room. The external drive has 139 GB of space available and the G5 is only using 51GB. Get Info says I have 148 GB capactiy and about 97 GB available. Does the external drive need room for the whole 148 GB to create the disk?
    The main difference between the other operations and the troublesome one is that I save the other Disk Images using my G5 running MacOS 10.4.11. The other Macs all were running 10.3.9. I'd access them in Target Mode on my G5 and save the Disk Image. When I tried to reverse the process and used the newest 10.3.9 machine (a G4) to save a dmg of my G5, I get the "too big" message.
    Any suggestions? Would Carbon Copy Cloner (or something else) allow me to do this from the G5? Any help would be appreciated.

    Found answer elsewhere.

Maybe you are looking for